Type Alias: BeforeToolHook

type BeforeToolHook = (context) => 
  | undefined
  | Promise<undefined>
  | BeforeToolHookResult
| Promise<BeforeToolHookResult>;

Defined in: hooks/types.ts:259

Hook called before tool execution (after permissions and guardrails).

Can be used for:

  • Custom validation
  • Input transformation
  • Execution mocking for tests
  • Rate limiting

Parameters

Parameter Type
context ToolHookContext

Returns

| undefined | Promise<undefined> | BeforeToolHookResult | Promise<BeforeToolHookResult>

void to proceed, or skip/modify options