class

ActionController::MCPServer::Tool

Inherits YAML::Serializable < JSON::Serializable < Reference < Object

a route exposed as a tool

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, body_type : Nil | String = nil)
Source
new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
Source
new(pull : JSON::PullParser)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source
new(*, __context_for_yaml_serializable ctx : YAML::ParseContext, __node_for_yaml_serializable node : YAML::Nodes::Node)
Source

Instance methods

behaviour

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

Source
behaviours

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

Source
body

the argument that holds the request body, if any

Source
body_type

the content type a body that is not JSON is sent as: the first the route consumes

Source
cache_ttl

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

Source
description
Source
icons

icons, src as written, see Icons

Source
input_schema

JSON schema describing the tool arguments

Source
long_running?

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

Source
max_bytes

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

Source
mime_type

the MIME type of the resource contents

Source
model?

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

Source
name
Source
params
Source
path

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

Source
proxy

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

Source
read_only?

only reads data, can be run by call_read_only

Source
resource

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

Source
root?

always available, without opening the toolbox

Source
subscribe?

clients can subscribe to updates of the resource

Source
title

the display name

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

Source
ui

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

Source
uri_template

the parsed resource template

Source
verb
Source
visibility

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

Source