module

Anthropic::ToolDispatch

Shared helpers for folding mid-conversation tool_removal / tool_addition blocks over the locally runnable tool set (mirrors official SDK tool dispatch).

Only role: "system" messages carry these blocks. Only a tool_reference can name a locally runnable tool — MCP references execute server-side and are ignored. mid_conv_system content is walked one level deep.

Instance methods

available_tool_names(messages : Array(MessageParam), tool_names : Enumerable(String)) : Set(String)

Fold mid-conversation tool_removal / tool_addition over tool_names.

Removal of an absent name is a set no-op. Addition is unconditional; the runner still requires a registry hit to execute a tool.

Source