Spot the bug in tool continuation

from Claude API
Claude Developer Platform (2026-09) intermediate 4 min 2 issues to find

Find the protocol errors in this generated tool continuation.

Python
def continue_tool(response, messages):
    call = response["content"][0]
    output = run_tool(call["name"], call["input"])
    messages.append({
        "role": "user",
        "content": [{
            "type": "tool_result",
            "tool_use_id": call["id"],
            "content": output,
        }],
    })
    return messages
Open in playground
Report an error