class
ActionController::MCPServer::Invoker
- ActionController::MCPServer::Invoker
- Reference
- Object
Overview
dispatches tool calls and prompts to the application routes in-process
Defined in:
action-controller/mcp/invoker.crConstructors
-
.new(route_handler : Router::RouteHandler, prompt_handler : Router::RouteHandler = Router::RouteHandler.new)
prompts are internal routes, not accessible via HTTP
Instance Method Summary
-
#call(tool : Tool, arguments : Hash(String, JSON::Any), origin : HTTP::Request, bound : Hash(String, String) = {} of String => String) : String
runs the route and returns a
CallToolResultJSON string. -
#dispatch(request : HTTP::Request, handler : Router::RouteHandler = @route_handler) : HTTP::Client::Response
runs the request through the application routes in-process
-
#forwarded_headers(origin : HTTP::Request) : HTTP::Headers
the credential headers copied from the MCP request
-
#get_prompt(prompt : Prompt, arguments : Hash(String, JSON::Any), origin : HTTP::Request, bound : Hash(String, String) = {} of String => String) : String
renders the prompt and returns a
GetPromptResultJSON string -
#probe(path : String, origin : HTTP::Request) : Bool
requests the route provided with the forwarded credentials, returning
trueon success
Constructor Detail
prompts are internal routes, not accessible via HTTP
Instance Method Detail
runs the route and returns a CallToolResult JSON string.
raises Unauthorized if authentication is enabled and the route responds with a 401
bound path params, from an endpoint URL, take precedence over the arguments
runs the request through the application routes in-process
the credential headers copied from the MCP request
renders the prompt and returns a GetPromptResult JSON string
raises RPCError if the prompt can't be rendered and Unauthorized if
authentication is enabled and the prompt responds with a 401
requests the route provided with the forwarded credentials, returning true on success