Skip to content

Graphorin API reference v0.1.0


Graphorin API reference / @graphorin/core / / ToolExecutionContext

Interface: ToolExecutionContext<TDeps>

Defined in: packages/core/src/contracts/tool.ts:217

Per-call execution context handed to Tool.execute(...). Carries the stable toolCallId, the parent RunContext, an AbortSignal tied to the surrounding agent run, structured tracer / logger handles, the streaming progress / content emitters, and a per-call secrets accessor scoped to the tool's secretsAllowed ACL.

Stable

Type Parameters

Type ParameterDefault type
TDepsunknown

Properties

PropertyModifierTypeDescriptionDefined in
loggerreadonlyLogger-packages/core/src/contracts/tool.ts:222
runContextreadonlyRunContext<TDeps>-packages/core/src/contracts/tool.ts:219
secretsreadonlyToolSecretsAccessorPer-call secrets accessor. The accessor enforces the tool's secretsAllowed ACL — calling require(...) for a key that is not on the allowlist throws SecretAccessDeniedError.packages/core/src/contracts/tool.ts:228
signalreadonlyAbortSignal-packages/core/src/contracts/tool.ts:220
toolCallIdreadonlystring-packages/core/src/contracts/tool.ts:218
tracerreadonlyTracer-packages/core/src/contracts/tool.ts:221

Methods

reportProgress()

ts
reportProgress(
   current, 
   total?, 
   message?): void;

Defined in: packages/core/src/contracts/tool.ts:235

Emit a progress event to subscribers of agent.stream(...). No-op on tools without streamingHint: true AND on aborted streams. The counter pair (current, total?) is consumer-rendered as a percentage when both fields are present.

Parameters

ParameterType
currentnumber
total?number
message?string

Returns

void


streamContent()

ts
streamContent(chunk): void;

Defined in: packages/core/src/contracts/tool.ts:241

Emit one chunk of content. Concatenated into the tool's assembled output per the buffer-becomes-output discipline. No-op on tools without streamingHint: true AND on aborted streams.

Parameters

ParameterType
chunkContentChunk

Returns

void