PreToolUseEvent

Fires before a tool is executed. Return a block result to prevent execution.

Usage

Source

PreToolUseEvent(
    _raw,
    ctx,
)

Parameter Attributes

_raw: dict[str, Any]
ctx: HookContext

Attributes

Name Description
event_name Hook lifecycle events that can trigger registered hooks.

event_name

Hook lifecycle events that can trigger registered hooks.

event_name: Event = Event.PreToolUse

Combinable with | to match multiple events in a single hook registration.

Examples

>>> hook(Event.Stop | Event.SubagentStop, message=review first, block=True)