Skip to content

bodhi-realtime-agent / ToolDefinition

Interface: ToolDefinition ​

Defined in: src/types/tool.ts:18

Declares a tool that Gemini can invoke during a voice session. The framework converts the Zod schema to a Gemini function declaration, validates arguments at runtime, and routes execution based on the execution mode.

Properties ​

behavior? ​

optional behavior?: FunctionBehavior

Defined in: src/types/tool.ts:43

Gemini Live function-call behavior for this tool. 'NON_BLOCKING' lets the model keep talking while the call runs; 'BLOCKING' makes it wait for the result. Unset falls back to the transport's functionBehavior, and if that is unset too, to 'BLOCKING' on every model, never to the model's own default (blocking on 3.1 Flash Live, non-blocking on 3.8 Live). Ignored by non-Gemini transports.


description ​

description: string

Defined in: src/types/tool.ts:22

Description shown to the model to guide tool selection.


execution ​

execution: ToolExecution

Defined in: src/types/tool.ts:26

Whether this tool runs inline (blocking) or in the background (non-blocking).


name ​

name: string

Defined in: src/types/tool.ts:20

Unique tool name (must match across declaration and execution).


parameters ​

parameters: ZodType

Defined in: src/types/tool.ts:24

Zod schema used for both Gemini declaration and runtime argument validation.


pendingMessage? ​

optional pendingMessage?: string

Defined in: src/types/tool.ts:37

For background tools: message sent to Gemini immediately so it can acknowledge the request.


scheduling? ​

optional scheduling?: "immediate" | "when_idle" | "silent" | "interrupt"

Defined in: src/types/tool.ts:35

Tool-result delivery scheduling hint. Default 'immediate' for inline tools.

  • 'immediate': send result and trigger a model response (default).
  • 'silent': send the result item to the conversation but do NOT trigger a model response. Useful for tools that are purely informational (e.g. set_transcription_mode whose result the user doesn't need spoken back).
  • 'when_idle' / 'interrupt': less common, see TransportToolResult.scheduling. Set on the tool definition so the model never sees the scheduling — it's a framework-side delivery hint.

timeout? ​

optional timeout?: number

Defined in: src/types/tool.ts:45

Execution timeout in milliseconds (default 30 000).

Methods ​

execute() ​

execute(args, ctx): Promise<unknown>

Defined in: src/types/tool.ts:47

Execute the tool with validated arguments and an abort-aware context.

Parameters ​

args ​

Record<string, unknown>

ctx ​

ToolContext

Returns ​

Promise<unknown>

Built with VitePress