Expand description
Tool hook system — PreToolUse / PostToolUse event interception.
Hooks run synchronously in the tool execution path. A hook can allow, block, or (future) modify a tool call. Multiple hooks are checked in registration order; the first Block wins.
Structs§
- Logging
Hook - Logging hook — emits a tracing event for every tool call and result.
- Permission
Hook - Enforces
allow/denyrules fromPermissionRulesConfig.
Enums§
- Hook
Decision - Decision returned by a hook’s
before_tool_usemethod.
Traits§
- Tool
Hook - Hook that runs before and after every tool execution.
Functions§
- run_
post_ hooks - Helper: run all registered hooks after a tool call.
- run_
pre_ hooks - Helper: run all registered hooks before a tool call.
Returns
HookDecision::Blockon first blocking hook; otherwiseAllow.