Claudio.MCP.ToolAdapter (Claudio v0.5.0)

View Source

Bridges MCP tools into Claudio request format.

Converts Claudio.MCP.Client.Tool structs (from any adapter) into the tool map format used by Claudio.Messages.Request.add_tool/2.

Example

{:ok, tools} = MyAdapter.list_tools(client)

request = Request.new("claude-sonnet-4-5-20250929")
|> Claudio.MCP.ToolAdapter.add_tools(tools)

# With server prefix for disambiguation:
|> Claudio.MCP.ToolAdapter.add_tools(tools, prefix: "my_server")

Summary

Functions

Converts a list of MCP tools and adds them to a request.

Converts a single MCP tool to the Claudio tool map format.

Functions

add_tools(request, tools, opts \\ [])

Converts a list of MCP tools and adds them to a request.

Options

  • :prefix - Prefix tool names with a server name (e.g., "my_server""my_server__search")

mcp_to_claudio(tool, prefix \\ nil)

@spec mcp_to_claudio(Claudio.MCP.Client.Tool.t(), String.t() | nil) :: map()

Alias for to_claudio_tool/2.

to_claudio_tool(tool, prefix \\ nil)

@spec to_claudio_tool(Claudio.MCP.Client.Tool.t(), String.t() | nil) :: map()

Converts a single MCP tool to the Claudio tool map format.