class
ActionController::MCPServer::Protocol
- ActionController::MCPServer::Protocol
- Reference
- Object
Overview
implements the MCP methods for an established session
Defined in:
action-controller/mcp/protocol.crConstant Summary
-
META_TOOLS =
{"{\"name\":\"list_toolboxes\",\"description\":\"Lists the available toolboxes, each groups related tools and prompts\",\"inputSchema\":{\"type\":\"object\",\"properties\":{}},\"annotations\":{\"readOnlyHint\":true}}", "{\"name\":\"open_toolbox\",\"description\":\"Adds the tools and prompts in a toolbox to your available tools and prompts, returning the definitions of its tools\",\"inputSchema\":#{TOOLBOX_ARGS},\"annotations\":{\"readOnlyHint\":true,\"idempotentHint\":true}}", "{\"name\":\"close_toolbox\",\"description\":\"Removes the tools and prompts in a toolbox, close toolboxes you are no longer using\",\"inputSchema\":#{TOOLBOX_ARGS},\"annotations\":{\"readOnlyHint\":true,\"idempotentHint\":true}}"} -
PROMPTS_CHANGED =
"{\"jsonrpc\":\"2.0\",\"method\":\"notifications/prompts/list_changed\"}" -
PROXY_ARGS =
"{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\",\"description\":\"the tool name, as returned by open_toolbox\"},\"arguments\":{\"type\":\"object\",\"description\":\"the tool arguments, matching its inputSchema\"}},\"required\":[\"name\"]}" -
PROXY_TOOLS =
{"{\"name\":\"call_read_only\",\"description\":\"Runs a tool that only reads data (proxy: call_read_only) from an open toolbox, use it when the tools returned by open_toolbox aren't in your available tools\",\"inputSchema\":#{PROXY_ARGS},\"annotations\":{\"readOnlyHint\":true,\"openWorldHint\":false}}", "{\"name\":\"call_tool\",\"description\":\"Runs a tool that can change data (proxy: call_tool) from an open toolbox, use it when the tools returned by open_toolbox aren't in your available tools. Prefer call_read_only for tools that only read data\",\"inputSchema\":#{PROXY_ARGS},\"annotations\":{\"readOnlyHint\":false,\"openWorldHint\":false}}"} -
TOOLBOX_ARGS =
"{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\",\"description\":\"the toolbox name, as returned by list_toolboxes\"}},\"required\":[\"name\"]}" -
TOOLS_CHANGED =
"{\"jsonrpc\":\"2.0\",\"method\":\"notifications/tools/list_changed\"}"
Constructors
-
.new(invoker : Invoker, endpoint : String | Nil = nil)
endpointis the path template of a controller endpoint,nilfor the global server
Instance Method Summary
-
#flat? : Bool
a controller endpoint lists every tool directly, there are no toolboxes
-
#handle(method : String, params : Hash(String, JSON::Any), session : Session, request : HTTP::Request, emitted : Array(String)) : String
returns the JSON result of the request, any notifications generated are appended to
emittedfor delivery before the result -
#initialize_result(protocol_version : String) : String
the
initializeresult for the negotiated protocol version
Constructor Detail
endpoint is the path template of a controller endpoint, nil for the global server
Instance Method Detail
def handle(method : String, params : Hash(String, JSON::Any), session : Session, request : HTTP::Request, emitted : Array(String)) : String
#
returns the JSON result of the request, any notifications generated are
appended to emitted for delivery before the result
def initialize_result(protocol_version : String) : String
#
the initialize result for the negotiated protocol version