AfterToolCallEvent
Defined in: src/hooks/events.ts:224
Event triggered after a tool execution completes. Fired after tool execution finishes, whether successful or failed. Uses reverse callback ordering for proper cleanup semantics.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AfterToolCallEvent(data): AfterToolCallEvent;Defined in: src/hooks/events.ts:242
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
data | { agent: LocalAgent; toolUse: { name: string; toolUseId: string; input: JSONValue; }; tool: Tool; result: ToolResultBlock; error?: Error; } |
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 |
data.result | ToolResultBlock |
data.error? | Error |
Returns
Section titled “Returns”AfterToolCallEvent
Overrides
Section titled “Overrides”Properties
Section titled “Properties”readonly type: "afterToolCallEvent";Defined in: src/hooks/events.ts:225
readonly agent: LocalAgent;Defined in: src/hooks/events.ts:226
toolUse
Section titled “toolUse”readonly toolUse: { name: string; toolUseId: string; input: JSONValue;};Defined in: src/hooks/events.ts:227
name: string;toolUseId
Section titled “toolUseId”toolUseId: string;input: JSONValue;readonly tool: Tool;Defined in: src/hooks/events.ts:232
result
Section titled “result”readonly result: ToolResultBlock;Defined in: src/hooks/events.ts:233
error?
Section titled “error?”readonly optional error?: Error;Defined in: src/hooks/events.ts:234
retry?
Section titled “retry?”optional retry?: boolean;Defined in: src/hooks/events.ts:240
Optional flag that can be set by hook callbacks to request a retry of the tool call. When set to true, the agent will re-execute the tool.
Methods
Section titled “Methods”toJSON()
Section titled “toJSON()”toJSON(): Pick<AfterToolCallEvent, "toolUse" | "type" | "result"> & { error?: { message?: string; };};Defined in: src/hooks/events.ts:268
Serializes for wire transport, excluding the agent reference, tool instance, and mutable retry flag. Converts Error to an extensible object for safe wire serialization. Called automatically by JSON.stringify().
Returns
Section titled “Returns”Pick<AfterToolCallEvent, "toolUse" | "type" | "result"> & {
error?: {
message?: string;
};
}