All Lessons

A developer builds a weather assistant that can call a get_forecast tool. When the user asks "What's the weather in Tokyo?", the model responds with a response that includes a tool_use block requesting the get_forecast tool with location="Tokyo". The developer needs to detect this in the API response. What stop_reason in Claude's response indicates the model wants to use a tool?

1 / 3
intermediate 20 min

Tool Use Blocks

Loading lesson content...

A developer sends a tool_use block to Claude but the model responds as if it doesn't see the result. What's likely wrong?

1 / 2

A tool_use interaction keeps looping: model calls tool, client returns result, model calls the same tool again repeatedly. What's likely wrong?

1 / 2