struct

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"}]
)
Source
new(mcp_server_name : String, default_config : MCPToolsetConfig | Nil = nil, configs : Hash(String, MCPToolsetConfig) | Nil = nil, cache_control : CacheControl | Nil = nil)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

cache_control
Source
configs
Source
default_config
Source
mcp_server_name
Source
type
Source