Certopolis

Claude Certified Architect – Foundations

is_error in tool_result: reporting tool failures

When a tool you run fails, still return a tool_result for that call, put the error text in content and set "is_error": true. Claude reads the failure and can retry, try another approach or explain the problem to the user.

How it works

Every tool_use block Claude sends needs a matching tool_result with the same tool_use_id in the next user message. A failure does not change that. If your weather lookup gets an HTTP 500, return {"type": "tool_result", "tool_use_id": "toolu_01...", "content": "ConnectionError: the weather service API is not available (HTTP 500)", "is_error": true}. Claude then works the error into its reply.

Write messages that help Claude recover. A bare failed gives it nothing to act on. Rate limit exceeded. Retry after 60 seconds. says what went wrong and what to do next.

Invalid calls and skipped calls

If Claude calls a tool with a missing or wrong parameter, return the problem as an error result, such as Error: Missing required 'location' parameter. Claude will retry 2 to 3 times with corrections before apologising to the user. To prevent invalid inputs in the first place, set strict: true on the tool.

If Claude sends several calls and you decide not to run one, for example because an earlier call in the batch failed, return a result for it with is_error: true and a brief reason such as Not executed: the preceding write_file call failed. Leaving it out makes the next request fail because a tool_use id has no result.

Server tools are different

is_error is for tools your code runs. Server tools such as web search run on Anthropic's side and report their own failures in the response, with codes such as max_uses_exceeded or query_too_long. Claude handles those itself, and you do not set is_error on them. Your own error handling should cover client tools only.

Where the exam catches people

  • Believing you can drop the block for a failed call: every tool_use needs a tool_result, or the next request is rejected.
  • Believing a normal-looking result is harmless when the tool refused: without is_error: true Claude may tell the user the work was done.
  • Believing a missing argument should abort the run: returning an error result lets Claude correct the call and try again.
  • Believing server tool errors need is_error from your code: they arrive already described, and Claude handles them.

Written from Anthropic's documentation

Try 3 questions on this

Pick an answer to see why each option is right or wrong.

  1. Your create_ticket tool refuses a call because the target project is archived. Your loop swallows the refusal and returns a normal-looking tool_result saying the ticket was filed, so Claude tells the user about work that never happened. You want Claude to learn the call failed and act on that. What's the most effective way to report this refusal?

    Right. In the game that’s Renown for your Agent Architecture and Orchestration building.

    Not that one: A is right. In the game your Agent Architecture and Orchestration building would lose a little Renown, and this question would come back later.

  2. Your platform team runs a Claude Sonnet 5 (claude-sonnet-5) agent whose inventory tool sometimes raises a timeout. Your current handler drops the block for the failed tool and returns only the successful tool_result blocks. Requests then fail with an invalid-request error, and when they do succeed the agent has no idea the lookup failed. What change would most effectively address this issue?

    Right. In the game that’s Renown for your Tool Design, MCP and Server Tools building.

    Not that one: B is right. In the game your Tool Design, MCP and Server Tools building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    Failures are signalled in-band: return the block with is_error: true and a short description as content. Claude then sees the failure, can retry, choose another tool, or explain the gap to the user.

    Written from platform.claude.com/docs/en/agents-and-tools/tool-use/handle-tool-calls

  3. Claude calls your send_report tool without the required recipient field. Your loop treats a missing argument as a defect, aborts the run and pages your on-call engineer. Your lead asks whether the loop could instead hand the problem back to Claude and let the run carry on. What's the correct approach to handle a malformed tool call?

    Right. In the game that’s Renown for your Agent Architecture and Orchestration building.

    Not that one: A is right. In the game your Agent Architecture and Orchestration building would lose a little Renown, and this question would come back later.