class

Autobot::Mcp::ProxyTool

Inherits Autobot::Tools::Tool < Reference < Object

Wraps a single MCP server tool as an autobot Tools::Tool.

The LLM sees proxy tools as native autobot tools. Each tool is named mcp_{server}_{tool} (sanitized to [a-z0-9_]) to avoid collisions.

to_schema passes the raw MCP inputSchema directly to the LLM, preserving nested JSON Schema that autobot's ToolSchema cannot represent.

Constants

COLLAPSE_PATTERN = /_+/
Log = ::Log.for("mcp.proxy_tool")
SANITIZE_PATTERN = /[^a-z0-9_]/

Constructors

from_mcp_tool(client : Client, tool_json : JSON::Any) : ProxyTool

Builds a ProxyTool from an MCP tools/list entry.

Extracts name, description, and inputSchema from the tool JSON, prefixes the name, and stores the raw schema for to_schema.

Source
new(client : Client, remote_name : String, name : String, description : String, parameters : Tools::ToolSchema, raw_input_schema : JSON::Any | Nil = nil)
Source

Class methods

build_name(server_name : String, tool_name : String) : String

Sanitize and prefix: mcp_{server}{tool}, only [a-z0-9]

Source
convert_schema(raw : JSON::Any | Nil) : Tools::ToolSchema

Best-effort conversion of MCP inputSchema to autobot's ToolSchema.

Maps known JSON Schema types to PropertySchema; falls back to "string" for unrecognized types. Used for basic validation only — the raw schema is sent to the LLM via to_schema.

Source

Instance methods

description
Source
execute(params : Hash(String, JSON::Any)) : Tools::ToolResult
Source
name
Source
parameters
Source
to_schema

Override to pass raw MCP inputSchema directly to the LLM, preserving nested JSON Schema that ToolSchema can't represent.

Source