Skip to main content

HookCallback

Type Alias HookCallback 

Source
pub type HookCallback = Arc<dyn Fn(HookInput, Option<String>, HookContext) -> BoxFuture<'static, Result<HookJSONOutput, Error>> + Send + Sync>;
Expand description

Callback type for hook functions.

Invoked when a matching hook event occurs. Receives:

  • input (HookInput) โ€” Event-specific input data.
  • tool_use_id (Option<String>) โ€” Optional tool use identifier (for tool-related hooks).
  • context (HookContext) โ€” Hook context with additional information.

Returns a HookJSONOutput JSON value with optional control and output fields.

Aliased Typeยง

pub struct HookCallback { /* private fields */ }