Skip to content

AfterToolCallEvent

Defined in: src/hooks/events.ts:223

Event triggered after a tool execution completes. Fired after tool execution finishes, whether successful or failed. Uses reverse callback ordering for proper cleanup semantics.

new AfterToolCallEvent(data): AfterToolCallEvent;

Defined in: src/hooks/events.ts:241

ParameterType
data{ agent: LocalAgent; toolUse: { name: string; toolUseId: string; input: JSONValue; }; tool: Tool; result: ToolResultBlock; error?: Error; }
data.agentLocalAgent
data.toolUse{ name: string; toolUseId: string; input: JSONValue; }
data.toolUse.namestring
data.toolUse.toolUseIdstring
data.toolUse.inputJSONValue
data.toolTool
data.resultToolResultBlock
data.error?Error

AfterToolCallEvent

HookableEvent.constructor

readonly type: "afterToolCallEvent";

Defined in: src/hooks/events.ts:224


readonly agent: LocalAgent;

Defined in: src/hooks/events.ts:225


readonly toolUse: {
name: string;
toolUseId: string;
input: JSONValue;
};

Defined in: src/hooks/events.ts:226

name: string;
toolUseId: string;
input: JSONValue;

readonly tool: Tool;

Defined in: src/hooks/events.ts:231


readonly result: ToolResultBlock;

Defined in: src/hooks/events.ts:232


readonly optional error?: Error;

Defined in: src/hooks/events.ts:233


optional retry?: boolean;

Defined in: src/hooks/events.ts:239

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.

toJSON(): Pick<AfterToolCallEvent, "toolUse" | "type" | "result"> & {
error?: {
message?: string;
};
};

Defined in: src/hooks/events.ts:267

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().

Pick<AfterToolCallEvent, "toolUse" | "type" | "result"> & { error?: { message?: string; }; }