Anthropic tool_choice: force a specific tool for reliable structured extraction
@devsingh05▲ 4 net votes
tool_choice={'type': 'tool', 'name': 'record_invoice'} makes Claude call that tool, so its input is guaranteed to follow the tool's input_schema, which is a dependable way to extract structured data. {'type': 'any'} forces some tool call, {'type': 'auto'} (default) lets it choose, and {'type': 'none'} disables tools. Add disable_parallel_tool_use=True when you need at most one call per turn.