Defining Schemas & Forcing Execution — Advanced Tool Use
[ ABORT TO HUD ]
SEQ. 1
SEQ. 2
Defining Schemas & Forcing Execution
Building the Tool Socket
Claude interacts with your code via Tools (Function Calling), defined using standard JSON Schema (optionally setting strict: true for guaranteed constrained-decoding parameter conformance). Clear descriptions in input_schema act as direct instructions guiding when and how Claude invokes each tool.
The tool_choice Parameter
By default (auto), Claude decides when to use a tool. For deterministic pipelines, you can override this logic:
auto: Model decides probabilistic selection.any: Forces Claude to use at least one tool from your list.tool: Forces Claude to use a specific tool name immediately.none: Prevents Claude from invoking any tools on that turn.
// Forcing a specific tool
"tool_choice": {"type": "tool", "name": "get_weather"}⌨ HANDS-ON LABForce Tool Call with tool_choice
⭐ +200 XPDefine a lookup_weather tool schema with JSON Schema input parameters, and force Claude to invoke it using tool_choice: {"type": "tool", "name": "lookup_weather"}.
1POST to /v1/messages with a tools array and tool_choice set to force lookup_weather.
OBJECTIVE 1 / 1 — type "hint" if stuck
SYNAPSE VERIFICATION
QUERY 1 // 2
How does the 'input_schema' assist the model's reasoning?
It provides the executable code
It mathematically binds Claude's weights to output types that map to your code's requirements
It displays a UI block
It parses TypeScript