BeforeToolCallEvent
Defined in: src/hooks/events.ts:149
Event triggered just before a tool is executed. Fired after tool lookup but before execution begins. Hook callbacks can set cancel to prevent the tool from executing.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new BeforeToolCallEvent(data): BeforeToolCallEvent;Defined in: src/hooks/events.ts:166
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
data | { agent: LocalAgent; toolUse: { name: string; toolUseId: string; input: JSONValue; }; tool: Tool; } |
data.agent | LocalAgent |
data.toolUse | { name: string; toolUseId: string; input: JSONValue; } |
data.toolUse.name | string |
data.toolUse.toolUseId | string |
data.toolUse.input | JSONValue |
data.tool | Tool |
Returns
Section titled “Returns”BeforeToolCallEvent
Overrides
Section titled “Overrides”Properties
Section titled “Properties”readonly type: "beforeToolCallEvent";Defined in: src/hooks/events.ts:150
readonly agent: LocalAgent;Defined in: src/hooks/events.ts:151
toolUse
Section titled “toolUse”readonly toolUse: { name: string; toolUseId: string; input: JSONValue;};Defined in: src/hooks/events.ts:152
name: string;toolUseId
Section titled “toolUseId”toolUseId: string;input: JSONValue;readonly tool: Tool;Defined in: src/hooks/events.ts:157
cancel
Section titled “cancel”cancel: string | boolean = false;Defined in: src/hooks/events.ts:164
Set by hook callbacks to cancel this tool call.
When set to true, a default cancel message is used.
When set to a string, that string is used as the tool result error message.