Skip to content

class ActionController::MCPServer::Tool
inherits Reference #

a route exposed as a tool

Included modules

JSON::Serializable YAML::Serializable

Extended modules

JSON::Schema

Constructors#

.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

.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)#

View source

.new(pull : JSON::PullParser)#

View source

.new(*, __pull_for_json_serializable pull : JSON::PullParser)#

View source

.new(*, __context_for_yaml_serializable ctx : YAML::ParseContext, __node_for_yaml_serializable node : YAML::Nodes::Node)#

View source

Methods#

#behaviour : Array(String) | ::Nil#

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

View source

#behaviours : Array(String)#

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

View source

#body : String | ::Nil#

the argument that holds the request body, if any

View source

#cache_ttl : Int32 | ::Nil#

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

View source

#description : String | ::Nil#

View source

#icons : Array(JSON::Any) | ::Nil#

icons, src as written, see Icons

View source

#input_schema : JSON::Any#

JSON schema describing the tool arguments

View source

#long_running? : Bool#

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

View source

#max_bytes : Int64 | ::Nil#

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

View source

#mime_type : String | ::Nil#

the MIME type of the resource contents

View source

#model? : Bool#

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

View source

#name : String#

View source

#params : Array(ToolParam)#

View source

#path : String#

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

View source

#proxy : String#

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

View source

#read_only? : Bool#

only reads data, can be run by call_read_only

View source

#resource : String | ::Nil#

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

View source

#root? : Bool#

always available, without opening the toolbox

View source

#subscribe? : Bool#

clients can subscribe to updates of the resource

View source

#title : String | ::Nil#

the display name

View source

#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

#ui : String | ::Nil#

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

View source

#uri_template : URITemplate | ::Nil#

the parsed resource template

View source

#verb : String#

View source

#visibility : Array(String) | ::Nil#

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

View source