PhoenixKit.API.MCP.Shape (phoenix_kit v2.63.0)

Copy Markdown View Source

How tools, results and errors look on MCP.

The version argument is the protocol revision of the request (MCP-Protocol-Version, 2025-03-26 when the header is absent). What a revision gets is its profile in PhoenixKit.API.MCP.Versions: title, outputSchema and structuredContent exist from 2025-06-18 on, and a client of the older revision gets text only.

The root of inputSchema and outputSchema is always sent as an object (MCP requires it and the executor accepts only an object); the rest of a schema is passed through as declared and PhoenixKit.API.ToolLint is what checks that it is sound.

Summary

Functions

What to do next after an error code, one sentence for an agent.

The result of a tools/call for an executor outcome.

The instructions of the initialize answer.

The serverInfo of the initialize answer.

Whether a client of revision version understands structuredContent (the :structured_content flag of its profile).

The MCP descriptor of tool for a client of revision version.

Functions

advice(code)

@spec advice(atom()) :: String.t()

What to do next after an error code, one sentence for an agent.

call_result(arg, version, request_id)

@spec call_result(PhoenixKit.API.Executor.outcome(), String.t(), String.t() | nil) ::
  map()

The result of a tools/call for an executor outcome.

Success: the JSON as text and, for a revision with :structured_content, the map as structuredContent. Error: isError: true, a line [code] message - what to do next and the problem document as JSON text, no structuredContent.

instructions(atom)

@spec instructions(PhoenixKit.API.Tool.audience()) :: String.t()

The instructions of the initialize answer.

server_info(audience, version)

@spec server_info(PhoenixKit.API.Tool.audience(), String.t()) :: map()

The serverInfo of the initialize answer.

structured?(version)

@spec structured?(String.t()) :: boolean()

Whether a client of revision version understands structuredContent (the :structured_content flag of its profile).

tool_descriptor(tool, version)

@spec tool_descriptor(PhoenixKit.API.Tool.t(), String.t()) :: map()

The MCP descriptor of tool for a client of revision version.