Tool Use & Function Calling

How do you return a tool result to Claude?

QUICK ANSWER

Return tool results in a user message block containing a list of content blocks of type 'tool_result'. Each block must specify the matching 'tool_use_id' to bind the result to the initial request.

Request Payload Example

{
  "role": "user",
  "content": [
    {
      "type": "tool_result",
      "tool_use_id": "toolu_01A2B3C4D5",
      "content": "The current weather in Denver is 72°F and sunny."
    }
  ]
}
Verified against: Anthropic API Tool Use v1