Skip to content

workflow / Exports / ToolEventHandler

Class: ToolEventHandler

ToolEventHandler - Handles tool call and response events

Implements

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new ToolEventHandler(logger?): ToolEventHandler

Parameters

NameTypeDefault value
loggerSimpleLoggerSilentLogger

Returns

ToolEventHandler

Defined in

handlers/tool-event-handler.ts:37

Properties

name

Readonly name: "ToolEventHandler"

Handler identification

Implementation of

EventHandler.name

Defined in

handlers/tool-event-handler.ts:26


priority

Readonly priority: HIGH = Priority.HIGH

Implementation of

EventHandler.priority

Defined in

handlers/tool-event-handler.ts:27


patterns

Readonly patterns: string[]

Implementation of

EventHandler.patterns

Defined in

handlers/tool-event-handler.ts:28

Methods

canHandle

canHandle(eventType): boolean

Check if this handler can process the event

Parameters

NameType
eventTypestring

Returns

boolean

Implementation of

EventHandler.canHandle

Defined in

handlers/tool-event-handler.ts:41


handle

handle(eventType, eventData): Promise<EventProcessingResult>

Process the event and return workflow updates

Parameters

NameType
eventTypestring
eventDataEventData

Returns

Promise<EventProcessingResult>

Implementation of

EventHandler.handle

Defined in

handlers/tool-event-handler.ts:51


getToolResponseId

getToolResponseId(toolCallId): undefined | string

Get tool response node ID for a given tool call ID

Parameters

NameType
toolCallIdstring

Returns

undefined | string

Defined in

handlers/tool-event-handler.ts:378


getToolCallsForThinking

getToolCallsForThinking(thinkingNodeId): string[]

Get all tool calls for a thinking node

Parameters

NameType
thinkingNodeIdstring

Returns

string[]

Defined in

handlers/tool-event-handler.ts:385


associateToolCallWithThinking

associateToolCallWithThinking(toolCallId, thinkingNodeId): void

Associate tool call with thinking node

Parameters

NameType
toolCallIdstring
thinkingNodeIdstring

Returns

void

Defined in

handlers/tool-event-handler.ts:398


getThinkingForToolCall

getThinkingForToolCall(toolCallId): undefined | string

Get thinking node for tool call

Parameters

NameType
toolCallIdstring

Returns

undefined | string

Defined in

handlers/tool-event-handler.ts:406


createToolResultNode

createToolResultNode(thinkingNodeId, sourceId): WorkflowNode

Create tool result aggregation node

Parameters

NameType
thinkingNodeIdstring
sourceIdstring

Returns

WorkflowNode

Defined in

handlers/tool-event-handler.ts:413


clear

clear(): void

Clear handler state (useful for testing and cleanup)

Returns

void

Defined in

handlers/tool-event-handler.ts:451

Released under the MIT License.