Class: Phronomy::Tool::McpTool
- Defined in:
- lib/phronomy/tool/mcp_tool.rb
Overview
A Phronomy::Tool::Base subclass that wraps a tool exposed by an external MCP (Model Context Protocol) server.
Currently supports the stdio transport only: the MCP server is launched as a child process and communicates via newline-delimited JSON-RPC on stdin/stdout.
HTTP/SSE transport support can be added later by subclassing Transport.
Defined Under Namespace
Classes: HttpTransport, StdioTransport
Class Method Summary collapse
-
.from_server(server_uri, tool_name:) ⇒ McpTool
Build a McpTool instance by querying a running MCP server for the tool definition identified by +tool_name+.
Methods inherited from Base
#call, #execute, #name, on_error, on_schema_error, param, param_enums, #params_schema, requires_approval, #requires_approval, #requires_approval?, retry_on, retry_policies, scope, tool_name
Class Method Details
.from_server(server_uri, tool_name:) ⇒ McpTool
Build a McpTool instance by querying a running MCP server for the tool definition identified by +tool_name+.
36 37 38 39 40 |
# File 'lib/phronomy/tool/mcp_tool.rb', line 36 def from_server(server_uri, tool_name:) transport = build_transport(server_uri) tool_def = transport.fetch_tool(tool_name) build_tool_class(tool_name, tool_def, transport).new end |