Skip to main content

ToolCallMiddleware

Agent Runtimes


Agent Runtimes / types/middleware / ToolCallMiddleware

Interface: ToolCallMiddleware

Defined in: types/middleware.ts:80

Middleware for intercepting tool calls

Properties

name

name: string

Defined in: types/middleware.ts:81


onToolCall

onToolCall: (options) => Promise<{ overrideResult?: ToolExecutionResult<unknown>; proceed: boolean; reason?: string; toolCall: ToolCallRequest; }>

Defined in: types/middleware.ts:87

Called before a tool is executed Can modify args, approve/reject, or skip execution

Parameters

options
context

MiddlewareContext

toolCall

ToolCallRequest

Returns

Promise<{ overrideResult?: ToolExecutionResult<unknown>; proceed: boolean; reason?: string; toolCall: ToolCallRequest; }>


onToolResult?

optional onToolResult?: (options) => Promise<{ result: ToolExecutionResult; }>

Defined in: types/middleware.ts:103

Called after a tool is executed (optional)

Parameters

options
context

MiddlewareContext

result

ToolExecutionResult

toolCall

ToolCallRequest

Returns

Promise<{ result: ToolExecutionResult; }>