Normandy.MCP.ToolWrapper
(normandy v0.6.1)
View Source
Wraps an MCP tool as a Normandy BaseTool implementation.
This allows MCP tools discovered via any Claudio.MCP.Client adapter
to be registered in a Normandy tool registry and used in the agent's
tool execution loop.
Example
alias Claudio.MCP.Client.Tool
alias Normandy.MCP.ToolWrapper
mcp_tool = %Tool{
name: "search",
description: "Search the web",
input_schema: %{"type" => "object", "properties" => %{"query" => %{"type" => "string"}}}
}
wrapper = %ToolWrapper{
adapter: Claudio.MCP.Adapters.ExMCP,
client: mcp_client_pid,
tool: mcp_tool,
prefix: "my_server"
}
# Register in agent
agent = BaseAgent.register_tool(agent, wrapper)
Summary
Functions
Creates a new ToolWrapper for an MCP tool.
Prepares the tool with LLM-provided input parameters.
Types
@type t() :: %Normandy.MCP.ToolWrapper{ adapter: module(), client: term(), input: map(), prefix: String.t() | nil, tool: Claudio.MCP.Client.Tool.t() }
Functions
@spec new(module(), term(), Claudio.MCP.Client.Tool.t(), keyword()) :: t()
Creates a new ToolWrapper for an MCP tool.
Parameters
adapter- The MCP adapter module (e.g.,Claudio.MCP.Adapters.ExMCP)client- The MCP client connectiontool- AClaudio.MCP.Client.Toolstructopts- Options including:prefixfor namespacing
Prepares the tool with LLM-provided input parameters.
Called by the BaseAgent tool loop instead of struct/2 for tools
with dynamic input schemas.