ExecuteToolContext
Defined in: src/middleware/stages.ts:105
Context passed to tool-stage middleware. Contains everything needed to understand and potentially modify the tool call.
Extends
Section titled “Extends”Properties
Section titled “Properties”readonly agent: LocalAgent;Defined in: src/middleware/stages.ts:107
The agent instance (escape hatch for advanced use cases).
readonly tool: Tool;Defined in: src/middleware/stages.ts:109
The resolved tool implementation, or undefined if not found.
toolUse
Section titled “toolUse”readonly toolUse: ToolUseData;Defined in: src/middleware/stages.ts:111
The tool use request (name, toolUseId, input).
invocationState
Section titled “invocationState”readonly invocationState: InvocationState;Defined in: src/middleware/stages.ts:113
Per-invocation state shared across hooks and tools.
Methods
Section titled “Methods”interrupt()
Section titled “interrupt()”interrupt<T>(params): MiddlewareInterruptResult<T>;Defined in: src/middleware/stages.ts:51
Request a human-in-the-loop interrupt.
On first execution (no prior response), throws InterruptError to halt the agent.
On resume (after the user provides a response), returns the response wrapped in
MiddlewareInterruptResult.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
T | JSONValue |
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
params | InterruptParams | Interrupt parameters (name, optional reason, optional preemptive response) |
Returns
Section titled “Returns”The user’s response wrapped in { response: T }
Throws
Section titled “Throws”InterruptError when no response has been provided yet