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, tools : Array(MCPToolListingEntry) | 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
tools

The server's tool listing, pinned: when present, the server is not asked for its tools before sampling and exactly these entries, with default_config and configs applied, are the toolset's tools. Copy it from the mcp_tool_listing block of an earlier response. Requires the mcp-client-2026-09-15 beta (attached automatically when set).

Source
type
Source