Interface: ToolExecutionContext
@providerprotocol/agents / index / ToolExecutionContext
Interface: ToolExecutionContext
Section titled “Interface: ToolExecutionContext”Defined in: src/execution/types.ts:700
Context injected into tools during execution.
Per UAP-1.0 Section 8.4, ExecutionStrategy MUST inject this context when invoking tools that accept a second parameter. This enables tools to inherit agent configuration and propagate sub-agent events.
UAP-1.0 Spec Section 8.4
Example
Section titled “Example”// Tool implementation receiving contextconst myTool: Tool = { name: 'my_tool', description: 'Tool that uses execution context', parameters: { type: 'object', properties: {} }, run: async (params, context?: ToolExecutionContext) => { console.log('Executing in agent:', context?.agentId); if (context?.onSubagentEvent) { // Can spawn sub-agents and propagate events } return 'result'; },};Properties
Section titled “Properties”agentId
Section titled “agentId”agentId:
string
Defined in: src/execution/types.ts:702
Agent instance ID for context inheritance
onSubagentEvent?
Section titled “onSubagentEvent?”
optionalonSubagentEvent:OnSubagentEvent
Defined in: src/execution/types.ts:708
Callback for propagating sub-agent events to parent
stateId
Section titled “stateId”stateId:
string
Defined in: src/execution/types.ts:704
Current state snapshot ID for tracing
toolCallId
Section titled “toolCallId”toolCallId:
string
Defined in: src/execution/types.ts:706
Tool call ID from the model response