PRODUCTION SCENARIO
Claude returns stop_reason: "tool_use" with a tool_use block whose id is toolu_01Abc and whose name is get_weather. The application runs the function and gets back "72F and sunny".
What must the next request append to the conversation history?
Answering here is anonymous. Nothing is saved unless you sign in.
Show answer and explanation
Answer: A `user` message whose first block is a `tool_result` carrying that `tool_use` id.
Results go back in a user message as tool_result blocks, those blocks must come first in the content array, and tool_use_id must match the id from the tool_use block so Claude can pair result with request. The Claude API has no tool or function role; it folds tool use into the user and assistant messages, which is what distinguishes it from other function-calling APIs. Leading with a text block returns a 400. And omitting the id breaks the pairing even when only one call is outstanding.