ToolContext
Defined in: src/tools/tool.ts:13
Context provided to tool implementations during execution. Contains framework-level state and information from the agent invocation.
Extends
Section titled “Extends”Interruptible
Properties
Section titled “Properties”toolUse
Section titled “toolUse”toolUse: ToolUse;Defined in: src/tools/tool.ts:18
The tool use request that triggered this tool execution. Contains the tool name, toolUseId, and input parameters.
agent: LocalAgent;Defined in: src/tools/tool.ts:24
The agent instance that is executing this tool. Provides access to agent state, conversation history, and cancellation state.
invocationState
Section titled “invocationState”invocationState: InvocationState;Defined in: src/tools/tool.ts:35
Per-invocation state shared across hooks and tools for the current agent invocation. Mutable — read and write freely; changes are visible to subsequent hooks, tools, and on AgentResult.invocationState.
Distinct from agent.appState: invocationState is ephemeral and accepts
arbitrary values, while appState is durable, JSON-serializable, and
deep-copied on read/write.
Methods
Section titled “Methods”interrupt()
Section titled “interrupt()”interrupt<T>(params): T;Defined in: src/interrupt.ts:343
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
T | JSONValue |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
params | InterruptParams |
Returns
Section titled “Returns”T
Inherited from
Section titled “Inherited from”Interruptible.interrupt