#[non_exhaustive]pub struct McpToolHook {
pub server: Option<String>,
pub tool: Option<String>,
pub input: Option<Map<String, Value>>,
pub timeout: Option<f64>,
pub condition: Option<String>,
pub status_message: Option<String>,
pub extra: Extra,
}Expand description
An mcp_tool hook.
Docs: settings reference.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.server: Option<String>Name of a configured MCP server. For a plugin-bundled
server, this is the
scoped name plugin:<plugin-name>:<server-name>, such as plugin:my-plugin:db, not the
bare server key.
- Values: string
Docs: server.
tool: Option<String>§input: Option<Map<String, Value>>Arguments passed to the tool. String values support ${path} substitution from the
hook’s JSON input, such
as "${tool_input.file_path}".
- Values: object
Docs: input.
timeout: Option<f64>Seconds before canceling. Claude Code doesn’t enforce it on a command hook you run with
async: true.
Defaults: 600 for command, http, and mcp_tool; 30 for prompt; 60 for agent.
- Values: a number
Docs: timeout.
condition: Option<String>Permission rule
syntax to filter
when this hook runs, such as "Bash(git *)" or "Edit(*.ts)". The hook command only
runs if the tool call matches the pattern. See the Bash matching
table for how Bash patterns
evaluate against subcommands, $(), and backticks.
- Values: string
Docs: if.
status_message: Option<String>§extra: ExtraKeys Claude Code accepts here that this crate doesn’t model (newer or undocumented ones), kept as written so the document round-trips.