The OpenAPI 3.1 document of the machine API, generated from the tool registry.
GET /api/admin/v1/openapi.json and GET /api/public/v1/openapi.json serve
it (PhoenixKit.API.REST). An agent or a client generator reads it to learn
every tool, its input and output schemas and the error format.
- every tool is
POST /<tool name>(the dot is part of the path);operationIdis that same dotted name; x-agent-safetyisreadfor a read-only tool,destructivefor one whoseannotations.destructiveis set, elsewrite(irreversibledoes not occur in v1);x-idempotentisannotations.idempotent;x-required-scopeis the scope an admin tool needs;- the request body schema is
PhoenixKit.API.Executor.input_schema/1, the schema the validator enforces; the200schema isPhoenixKit.API.OutputShape.for_tool/1, the same as MCP'soutputSchema(a write tool may answer with a preview instead); - a write tool (
PhoenixKit.API.ControlFields.write_tool?/1) that can replay (PhoenixKit.API.ControlFields.replay_tool?/1) also takes the optionalIdempotency-Keyrequest header, can answer with theIdempotent-Replayedheader on a replay (for the admin API also on the held answer of an operation that already waits for approval), and lists409(a confirmation code that is not valid, an idempotency key reused for another request or still in progress); - errors are RFC 9457
application/problem+json, defined once incomponents.schemas.Problem.
build/3 is pure. respond/2 builds the document for the tools the caller
may use (a key sees only what its effective scopes unlock; a module that is
switched off is absent) and sends it.
Summary
Functions
Builds the document for tools (the tools of one audience).
Sends the document for the tools the caller may use. Costs one rate-limit unit, like the discovery list; answers the executor's error otherwise.
Functions
@spec build([PhoenixKit.API.Tool.t()], PhoenixKit.API.Tool.audience(), keyword()) :: map()
Builds the document for tools (the tools of one audience).
Options: :server_url (the REST base URL, required), :title (required),
:version (the version of the API description, default "1").
@spec respond(Plug.Conn.t(), PhoenixKit.API.Tool.audience()) :: Plug.Conn.t()
Sends the document for the tools the caller may use. Costs one rate-limit unit, like the discovery list; answers the executor's error otherwise.