Skip to content
BENIBIX Learn

MCP Tool Hook

AI⌨️ Claude CodeConfiguration

Also known as type: mcp_tool

A hook that calls a tool on an MCP server.

Think of it like

It is like you ask a helper you already know. You give them one more job.

Example

Jack already has an MCP server that scans for secrets. An MCP tool hook calls it on each file Claude writes, with no extra script.

Why it matters

It reuses a tool you trust instead of writing a new script around it.

Definition

An MCP tool hook is a hook whose type is mcp_tool, so it calls a tool on an MCP server you have set up. You name the server, the tool and its input. The input can pull values from the event, such as ${tool_input.file_path}. The tool's text reply is read the same way as a command hook's output.

Example code

json
{
  "type": "mcp_tool",
  "server": "security",
  "tool": "scan_file",
  "input": { "path": "${tool_input.file_path}" }
}
Scan each file Claude writes.

Common mistake

Naming a plugin's server by its short name. A server from a plugin has a longer name that starts with plugin.

Key takeaways

  1. 1
    Calls an MCP tool. Server and tool.
  2. 2
    Fills in values. From the event.
  3. 3
    Reply as output. Like a command.