Skip to main content

PermissionHook

Type Alias PermissionHook 

Source
pub type PermissionHook = Arc<dyn Fn(&str, &Value) -> PermissionDecision + Send + Sync>;
Expand description

Signature for a permission hook: Fn(&tool_name, &arguments) -> PermissionDecision.

The hook is invoked just before each tool execution. It can:

  • Allow the call unchanged,
  • Deny it with a reason (fed back as a tool error),
  • Transform the arguments before execution.

Hooks must be Send + Sync because the agent loop is Send.

Aliased Typeยง

pub struct PermissionHook { /* private fields */ }