Tool Use & Function Calling
What is tool_choice and how do you use it?
QUICK ANSWER
tool_choice governs how Claude selects tools. Use 'auto' to let Claude decide whether to use tools, 'any' to force Claude to select at least one tool, or type 'tool' with a name to force a specific tool.
tool_choice Options
| Option Format | Behavior Description |
|---|---|
{"type": "auto"} |
Default. Claude decides whether to call a tool or respond with plain text. |
{"type": "any"} |
Forces Claude to call at least one of the provided tools. |
{"type": "tool", "name": "x"} |
Forces Claude to call the tool named x. |
Verified against: Anthropic API Spec