Skip to content

bodhi-realtime-agent / ToolExecutor

Class: ToolExecutor ​

Defined in: src/tools/tool-executor.ts:23

Executes inline tool calls requested by Gemini.

For each tool call: validates arguments via Zod, creates an AbortController, fires onToolCall/onToolResult hooks, publishes EventBus events, and enforces timeouts. Multiple tool calls can run concurrently — each is tracked in the pending map.

Constructors ​

Constructor ​

new ToolExecutor(hooks, eventBus, sessionId, agentName, sendJsonToClient?, setDirective?): ToolExecutor

Defined in: src/tools/tool-executor.ts:32

Parameters ​

hooks ​

HooksManager

eventBus ​

IEventBus

sessionId ​

string

agentName ​

string

sendJsonToClient? ​

(message) => void

Delivers ToolContext.sendJsonToClient frames to the client. Implement it as (message: AnyServerToClientMessage) => void or as (message: Record<string, unknown>) => void; both shapes are accepted.

setDirective? ​

(key, value, scope?) => void

Returns ​

ToolExecutor

Accessors ​

pendingCount ​

Get Signature ​

get pendingCount(): number

Defined in: src/tools/tool-executor.ts:192

Returns ​

number

Methods ​

cancel() ​

cancel(toolCallIds): void

Defined in: src/tools/tool-executor.ts:169

Abort one or more pending tool executions and fire cancellation hooks/events.

Parameters ​

toolCallIds ​

string[]

Returns ​

void


handleToolCall() ​

handleToolCall(call): Promise<ToolResult>

Defined in: src/tools/tool-executor.ts:50

Execute a tool call: validate args, run with timeout, fire hooks, return result.

Parameters ​

call ​

ToolCall

Returns ​

Promise<ToolResult>


register() ​

register(tools): void

Defined in: src/tools/tool-executor.ts:43

Parameters ​

tools ​

ToolDefinition[]

Returns ​

void

Built with VitePress