A team is building a tool-use agent and wants Claude to always invoke a specific tool (a search function) rather than answering from its training knowledge. Which API parameter achieves this most reliably?
Select an answer to reveal the explanation.
Short Explanation
You want Claude to always call the search tool, so use tool_choice: {type: 'tool', name: 'search'}. That API-level setting forces Claude to invoke that exact tool instead of answering from training knowledge.
Full Explanation
The tool_choice parameter with type: 'tool' and a specific tool name forces Claude to call that exact tool in its response, regardless of whether it could answer from training knowledge. This is the authoritative API-level control for ensuring tool invocation. The temperature setting of 0 affects output determinism, not tool use behavior, so it does not force tool calls. The system-prompt instruction to always use the search tool is less reliable than the dedicated API parameter; instruction-following can be inconsistent under adversarial inputs or unusual conversation contexts. Defining only the search tool in the tools array doesn't force its use — with tool_choice: 'auto', the default, Claude can still choose to respond in text even when only one tool is defined.