Tips // Claude in practice

Tips for working better with Claude

One short tip at a time, with an example you can copy. Move through them at random or search for what you need.

APIIntermediateClaude API

tool_choice: auto, any or a forced tool

If you need guaranteed structured output or a fixed first step, do not let Claude choose between answering in text or calling a tool.

auto is the default: Claude decides whether to use a tool or answer with text. any forces it to call some tool (useful with several extraction schemas, Claude picks the right one). Forcing a tool by name fixes the order: for example, extract_metadata first and enrichment afterwards.

Example
"tool_choice": {"type": "auto"}
"tool_choice": {"type": "any"}
"tool_choice": {"type": "tool", "name": "extract_metadata"}
#tool-choice#extraction#tool-use