Skip to main content

Module hooks

Module hooks 

Source
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§

LoggingHook
Logging hook — emits a tracing event for every tool call and result.
PermissionHook
Enforces allow / deny rules from PermissionRulesConfig.

Enums§

HookDecision
Decision returned by a hook’s before_tool_use method.

Traits§

ToolHook
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::Block on first blocking hook; otherwise Allow.