All Lessons

A developer is implementing the tool use loop. Claude calls a search_customer tool and the client executes it, getting back customer data. Now the developer needs to construct the tool_result to return to Claude. The developer notices that each tool_use block has an "id" field like "toolu_abc123". What field in the tool_use block must be included in the tool_result to link the result to the correct tool call?

1 / 3
intermediate 20 min

Tool Result Handling

Loading lesson content...

A tool returns a large result (50K tokens). The developer puts it all in tool_result.content. The next model response is slow and expensive. What should they do?

1 / 2

A weather tool sometimes returns 'API rate limit exceeded'. Claude should wait and retry, but instead gives up. How to handle this?

1 / 2