Anthropic::MCPToolset
Inherits JSON::Serializable < Anthropic::ServerTool < JSON::Serializable < Struct < Value < Object
MCP toolset tool — declares an MCP server's tools for the mcp-client beta
Used together with mcp_servers parameter. Each MCPToolset entry tells the
API which MCP server's tools to expose, with optional per-tool configuration.
message = client.beta.messages.create(
betas: [Anthropic::MCP_CLIENT_BETA],
model: Anthropic::Model::CLAUDE_SONNET_4_6,
max_tokens: 1024,
mcp_servers: [server_def],
server_tools: [Anthropic::MCPToolset.new(mcp_server_name: "my-server")],
messages: [{role: "user", content: "Use my MCP tools"}]
)
Constructors
new(pull : JSON::PullParser)
MCP toolset tool — declares an MCP server's tools for the mcp-client beta
Used together with mcp_servers parameter. Each MCPToolset entry tells the
API which MCP server's tools to expose, with optional per-tool configuration.
message = client.beta.messages.create(
betas: [Anthropic::MCP_CLIENT_BETA],
model: Anthropic::Model::CLAUDE_SONNET_4_6,
max_tokens: 1024,
mcp_servers: [server_def],
server_tools: [Anthropic::MCPToolset.new(mcp_server_name: "my-server")],
messages: [{role: "user", content: "Use my MCP tools"}]
)
new(mcp_server_name : String, default_config : MCPToolsetConfig | Nil = nil, configs : Hash(String, MCPToolsetConfig) | Nil = nil, cache_control : CacheControl | Nil = nil)
Sourcenew(*, __pull_for_json_serializable pull : JSON::PullParser)
SourceInstance methods
cache_control
Sourceconfigs
Sourcedefault_config
Sourcemcp_server_name
Sourcetype
Source