All Agent Engineering

Claude Code MCP tool hooks: names and output contract

Use the configured MCP server name and inspect the tool return contract.

AINavWritten / Updated
On this page

At a glance

This page explains one configuration contract from official documentation and records the local synthetic checks. It changes no actual settings, runs no hook, creates no subagent and calls no external service. Documented capabilities are separate from execution results.

Runtime and applicability

Article type
Spec file
Verified
Applies to
  • Claude Code Applies to the documented Claude Code configuration; version and event support appear in the body.

File locations

PathScopeHow it is read
settings: type=mcp_tool Hook; configured MCP serverThe event or subagent configuration described in this page.Read by Claude Code during relevant configuration loading and event execution; not enabled in this run.

When to use

  • Use when inspecting this configuration, loading location and result contract.

When not to use

  • Stop integration and consult specific documentation when the event, version or permission boundary is unclear.

Locate the connected server and tool

An MCP tool hook uses type=mcp_tool, server for the configured MCP server name, tool for the tool name and input for arguments. A plugin-provided server uses plugin:<plugin-name>:<server-name> rather than its bare internal server key. Establish server and tool availability in this session before selecting an event hook.

Input values come from event JSON

Input strings support ${path} substitution from event JSON, such as ${tool_input.file_path}. This is an event-field path rather than the HTTP header environment allowlist. A synthetic file_path=src/demo.ts can check argument mapping. It is practice text only; no scanner was called and no real repository file was read by a hook.

A tool error does not establish a block

Claude Code reads tool text content using the command-hook stdout parsing rule; isError=true produces a non-blocking error and execution continues. For action control, inspect the event decision format and failure policy rather than merely confirming that an MCP call returned. Stop relying on the verifier when names mismatch, fields are absent or output cannot be parsed.

Sources

All links are official pages; verification dates are listed per source, and links point to the version checked.

  1. Anthropic · Hooks reference

Found an error? Tell us →