AI Tool Call Debugger
Find missing or misplaced tool results in OpenAI and Claude requests.
When a tool runs, your app sends its result back in the conversation. If the assistant calls two tools at once, both need a reply before the conversation continues. An interrupted tool or a trimmed message history can leave one call unanswered.
OpenAI reports that an assistant message with tool_calls must be followed by tool messages. Return one role: "tool" message per call, with its original ID in tool_call_id.
If a turn calls call_1 and call_2 but only returns the second result, add the first result to the same exchange.
{"role": "tool", "tool_call_id": "call_1", "content": "42"}OpenAI function calling guide Claude reports unexpected tool_use_id when a result points to a call it can't find in the preceding assistant message. Compare the two IDs. If you shortened the history, restore the original call along with its result.
A result labeled call_2 can't answer call_1. Use the same ID on both blocks.
[
{"role": "assistant", "content": [{"type": "tool_use", "id": "call_1", "name": "lookup", "input": {}}]},
{"role": "user", "content": [{"type": "tool_result", "tool_use_id": "call_1", "content": "42"}]}
] If Claude reports tool_use ids were found without tool_result blocks immediately after, check the next user message. Put all the results from that turn in one message, with any text after the results.
If the user message starts with Thanks., move that text below the result.
{"role": "user", "content": [
{"type": "tool_result", "tool_use_id": "call_1", "content": "42"},
{"type": "text", "text": "Thanks."}
]}Claude tool call and result formats