Skip to content

bodhi-realtime-agent / ToolContext

Interface: ToolContext

Defined in: types/tool.ts:38

Runtime context provided to a tool's execute function. Includes identifiers for correlation and an AbortSignal for cancellation.

Properties

abortSignal

abortSignal: AbortSignal

Defined in: types/tool.ts:46

Aborted when the tool call is cancelled (user interruption or timeout).


agentName

agentName: string

Defined in: types/tool.ts:42

Name of the agent that owns this tool.


sessionId

sessionId: string

Defined in: types/tool.ts:44

Session in which this tool call is happening.


toolCallId

toolCallId: string

Defined in: types/tool.ts:40

Unique identifier for this specific tool invocation.

Methods

sendJsonToClient()?

optional sendJsonToClient(message): void

Defined in: types/tool.ts:48

Send a JSON message to the connected client (delivered as a WebSocket text frame).

Parameters

message

Record<string, unknown>

Returns

void


setDirective()?

optional setDirective(key, value, scope?): void

Defined in: types/tool.ts:58

Set an active directive by category key. Directives are reinforced every turn via sendClientContent injection, keeping them fresh in Gemini's context to prevent behavioral drift. Pass null to clear a directive.

Parameters

key

string

value

string | null

scope?

'session' persists across agent transfers (e.g. pacing); 'agent' (default) is cleared on agent transfer.

"session" | "agent"

Returns

void

Built with VitePress