class ActionController::MCPServer::Tool

Overview

a route exposed as a tool

Included Modules

Extended Modules

Defined in:

action-controller/mcp/description.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(name : String, description : Nil | String, verb : String, path : String, params : Array(ActionController::MCPServer::ToolParam), body : Nil | String, input_schema : JSON::Any, root : Bool = false, behaviour : Nil | Array(String) = nil, ui : Nil | String = nil, visibility : Nil | Array(String) = nil, title : Nil | String = nil, icons : Nil | Array(JSON::Any) = nil, resource : Nil | String = nil, mime_type : Nil | String = nil, subscribe : Bool = false, cache_ttl : Int32 | Nil = nil, long_running : Bool = false, max_bytes : Int64 | Nil = nil) #

[View source]
def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) #

[View source]
def self.new(pull : JSON::PullParser) #

[View source]

Instance Method Detail

def behaviour : Array(String) | Nil #

what the tool does, see #behaviours. nil infers it from the HTTP verb


[View source]
def behaviours : Array(String) #

what the tool does, @[AC::MCP(behaviour:)] or inferred from the HTTP verb


[View source]
def body : String | Nil #

the argument that holds the request body, if any


[View source]
def cache_ttl : Int32 | Nil #

seconds a resource read can be cached, nil uses MCPServer.cache_ttl


[View source]
def description : String | Nil #

[View source]
def icons : Array(JSON::Any) | Nil #

icons, src as written, see Icons


[View source]
def input_schema : JSON::Any #

JSON schema describing the tool arguments


[View source]
def long_running? : Bool #

streams progress and spools the response to disk, see MCPServer::RequestContext


[View source]
def max_bytes : Int64 | Nil #

the maximum response size, in bytes, of a long running route


[View source]
def mime_type : String | Nil #

the MIME type of the resource contents


[View source]
def model? : Bool #

the model can call the tool, it's not for cards only


[View source]
def name : String #

[View source]
def params : Array(ToolParam) #

[View source]
def path : String #

the route template, i.e. /users/:id


[View source]
def proxy : String #

the proxy tool that runs this tool, for clients that can't see it


[View source]
def read_only? : Bool #

only reads data, can be run by call_read_only


[View source]
def resource : String | Nil #

the resource template the route is also readable as, i.e. app://widgets/{id}


[View source]
def root? : Bool #

always available, without opening the toolbox


[View source]
def subscribe? : Bool #

clients can subscribe to updates of the resource


[View source]
def title : String | Nil #

the display name


[View source]
def to_mcp_json(json : JSON::Builder, proxy : Bool = false, ui : Bool = false, host : String | Nil = nil, bound : Hash(String, String) | Nil = nil) : Nil #

the tool definition as returned by tools/list, proxy: true also names the proxy tool that runs it and ui: true includes the MCP Apps metadata. host resolves icon paths


[View source]
def ui : String | Nil #

the MCP Apps card rendered for the tool, i.e. ui://bookings/card.html


[View source]
def uri_template : URITemplate | Nil #

the parsed resource template


[View source]
def verb : String #

[View source]
def visibility : Array(String) | Nil #

who can call the tool, model and/or card. nil is both


[View source]