Unclear What an mcp_tool hook now does when it fails is not stated.
What
A hook is a command or call you configure to run automatically at certain points, for example before Claude uses a tool. An mcp_tool hook does this by calling a tool from an MCP server, which is an outside tool connected to Claude Code. Each hook can say what should happen if it fails, through its onFailure setting.
mcp_toolhooks are now handled in the same branch ashttpandcallbackhooks, and theironFailure === "block"setting is honoured.- The failure path no longer gives
mcp_toolhooks theonFailure"continue" treatment. The early return that path used now applies only to hooks that are notmcp_tool. - A separate general check that treats a hook as
onFailure"block" now also skipsmcp_toolhooks. - When Claude Code compares two
mcp_toolhooks to decide whether they are duplicates, it now also checks whether each blocks on failure. Two hooks that differ only in that are kept separate instead of merged. - Calls made by
mcp_toolhooks now pass{ frames: e.hookOrigin }, which records where the hook came from.
Why
An mcp_tool hook set to block on failure can now stop the action it guards, as http hooks already could. If you rely on such a hook to let things continue when it fails, check how it behaves after this change.
The entry above is what we published on the day. These lines were added later, as Anthropic's own pages caught up, and they sit beside the original rather than replacing it.
On v2.1.329 or later, expect a call from code to run by default after a hook failure other than `the hook did not finish`. To choose whether the call runs, use a `command` or `http` hook and set [`onFailure`](https://code.claude.com/docs/e…code-mode see the edit
| `mcp_tool_use` | `tool_call` with `anthropic_mcp_server_name` |api/opentelemetry/spans see the edit
What an mcp_tool hook now does when it fails is not stated.
Anthropic's documentation has since written up mcp_tool, on spans.
Added "onFailure": "block" for mcp_tool hooks, as for command and HTTP hooks: a hook whose call fails blocks the action