Anthropic tool use: 'tool_use ids were found without tool_result blocks immediately after'
@devsingh05▲ 10 net votes
After the assistant returns tool_use blocks, the next message must be a user message whose content starts with one tool_result block per tool_use, each with the matching tool_use_id. Common mistakes: appending only the text and dropping the assistant's tool_use content, putting text before the tool_result blocks, or answering only some of several parallel tool calls. Append the full assistant content (response.content) to history unchanged, then the tool_result blocks; return errors as tool_result with is_error: true.