[ ABORT TO HUD ]
SEQ. 1
SEQ. 2

Defining Schemas & Forcing Execution

🔧 Advanced Tool Use⏱ 20 min⭐ 500 BASE XP⌨ HANDS-ON LAB

Building the Tool Socket

Claude interacts with your code via Tools (Function Calling). These are defined using standard JSON Schema. Precise descriptions in the input_schema are critical; they aren't just for developers-the model uses these descriptions as 'instructions' to understand when and how to call the 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 ID immediately.
// Forcing a specific tool
"tool_choice": {"type": "tool", "name": "get_weather"}
⌨ HANDS-ON LABForce Tool Call with tool_choice
⭐ +200 XP

Define 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.
lab-sandbox — simulated environment
INFINITY LAB SANDBOX v2.6 — simulated shell
Type the command for the current objective. Helpers: "hint", "solution", "clear".
$
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