Skip to main content
POST /v1/messages Tools are declared with a flat input_schema (no outer type: "function" wrapper). The model returns tool_use content blocks.

Define a tool

Full loop

Streaming

Stream with stream=True. Tool-use blocks arrive as content_block_start with type: "tool_use", followed by input_json_delta events. stop_reason: "tool_use" signals the turn needs a follow-up with tool_result.

Forcing a tool

{type: "any"} forces some tool; {type: "auto"} is the default.

Parallel tool calls

Multiple tool_use blocks can appear in the same response. Return one tool_result block per tool_use_id in the next user turn.
Last modified on April 21, 2026