Skip to content

Graphorin API reference v0.1.0


Graphorin API reference / @graphorin/core / / ResolvedTool

Interface: ResolvedTool<TInput, TOutput, TDeps>

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

Resolved record returned by the ToolRegistry getter. Carries every non-public registration-time field downstream layers consume (sanitization, audit, retrieval, side-effect classification, collision resolution, …) so consumers do not have to recompute it.

Stable

Extends

  • Tool<TInput, TOutput, TDeps>

Type Parameters

Type ParameterDefault type
TInputunknown
TOutputunknown
TDepsunknown

Properties

PropertyModifierTypeDescriptionInherited fromDefined in
__effectiveDeferLoadingreadonlyboolean--packages/core/src/contracts/tool.ts:188
__exampleCountreadonlynumber--packages/core/src/contracts/tool.ts:192
__hasIdempotencyKeyreadonlyboolean--packages/core/src/contracts/tool.ts:190
__preferredModel?readonly| ModelHint | ModelSpec--packages/core/src/contracts/tool.ts:193
__sideEffectClassreadonlySideEffectClass--packages/core/src/contracts/tool.ts:189
__sourcereadonlyToolSource--packages/core/src/contracts/tool.ts:187
__streamingHintreadonlyboolean--packages/core/src/contracts/tool.ts:191
__trustClassreadonlyToolTrustClass--packages/core/src/contracts/tool.ts:186
defer_loading?readonlybooleanDefer the tool from the per-step catalogue until the model invokes the built-in tool_search to look it up. Tools with deferred loading are not advertised to the model on every step, which keeps the input-token cost bounded for installations with dozens of MCP-derived tools. Default falseTool.defer_loadingpackages/core/src/contracts/tool.ts:93
descriptionreadonlystring-Tool.descriptionpackages/core/src/contracts/tool.ts:37
examples?readonlyreadonly ToolExample<TInput, TOutput>[]Worked examples shown to the model alongside the tool's description. Bounded [1, 5] — overflow emits a one-time WARN at registration. Each example's input and output is validated against the tool's inputSchema / outputSchema.Tool.examplespackages/core/src/contracts/tool.ts:111
examplesEagerlyRendered?readonlybooleanRender examples eagerly (every step) regardless of defer_loading. When undefined the runtime applies the auto-rule: defer_loading: truefalse; defer_loading: falsetrue; neither ⇒ undefined (the agent runtime decides at assembly time).Tool.examplesEagerlyRenderedpackages/core/src/contracts/tool.ts:118
executionMode?readonly"parallel" | "sequential"Sequential execution mode hints. Tools tagged 'sequential' are never executed in parallel with each other; the executor serializes them inside the per-step batch. Default 'parallel'Tool.executionModepackages/core/src/contracts/tool.ts:59
failClosed?readonlybooleanWhen true, an inbound-sanitization hit returns ToolError({ kind: 'inbound_sanitization_blocked' }) instead of forwarding the (sanitized) result. Intended for regulated deployments. Default falseTool.failClosedpackages/core/src/contracts/tool.ts:83
idempotencyKey?readonly(input, ctx) => string | Promise<string>Optional callback returning a deterministic dedup key per (input, ctx) tuple. REQUIRED-by-WARN for 'side-effecting' / 'external-stateful' tools. The framework does not validate determinism — that is the operator's contract.Tool.idempotencyKeypackages/core/src/contracts/tool.ts:132
inboundSanitization?readonlyInboundSanitizationPolicyInbound prompt-injection sanitization policy.Tool.inboundSanitizationpackages/core/src/contracts/tool.ts:75
inputSchemareadonlyZodLikeSchema<TInput>-Tool.inputSchemapackages/core/src/contracts/tool.ts:38
maxResultTokens?readonlynumberMaximum number of tokens the assembled tool result may carry into the conversation history. 0 disables the cap (logs a one-time WARN at registration). Counted against text-shaped output and text-shaped contentParts entries; non-text parts pass through. Default 16384Tool.maxResultTokenspackages/core/src/contracts/tool.ts:102
memoryGuardTier?readonlyMemoryGuardTierMemory-modification guard tier (DEC-153).Tool.memoryGuardTierpackages/core/src/contracts/tool.ts:73
namereadonlystring-Tool.namepackages/core/src/contracts/tool.ts:36
needsApproval?readonlyboolean | ((input, ctx) => boolean | Promise<boolean>)Either a static boolean or a predicate consulted at runtime against the realized input. true means the runtime suspends the run with a tool.approval.requested event before the tool executes.Tool.needsApprovalpackages/core/src/contracts/tool.ts:45
outputSchema?readonlyZodLikeSchema<TOutput, unknown>-Tool.outputSchemapackages/core/src/contracts/tool.ts:39
preferredModel?readonly| ModelHint | ModelSpecPer-tool author-time model hint. Either a cost-tier vocabulary literal (`'fast''balanced''smart') OR an explicit ModelSpec` that always wins over the agent-side tier mapping.
sandboxPolicy?readonlySandboxPolicySandbox isolation level. Defaults are picked by @graphorin/security.Tool.sandboxPolicypackages/core/src/contracts/tool.ts:49
secretsAllowed?readonlyreadonly string[]Per-tool secrets ACL. Tool execution is wrapped in a scope where ctx.secrets.require(...) only resolves keys present here. Empty / undefined means the tool may not request any secret.Tool.secretsAllowedpackages/core/src/contracts/tool.ts:65
sensitivity?readonlySensitivitySensitivity ceiling of the tool's input + output payload. Used by the redaction validator to decide whether the result may flow to a given sink (provider / exporter).Tool.sensitivitypackages/core/src/contracts/tool.ts:71
sideEffectClass?readonlySideEffectClassREQUIRED side-effect classification. v0.1 transition mode emits a one-time WARN per tool name on missing classification and applies the conservative deferred default 'side-effecting'; v0.2 may promote the WARN to a registration error.Tool.sideEffectClasspackages/core/src/contracts/tool.ts:125
streamingHint?readonlytrueOpt-in flag for streaming-tool execution. The ?: true typing rejects streamingHint: false on purpose — absence is the canonical "non-streaming" signal preserving v0.1 behaviour. When true, Tool.execute(...) may call ctx.streamContent(...) / ctx.reportProgress(...) and may return Promise<void>.Tool.streamingHintpackages/core/src/contracts/tool.ts:143
tags?readonlyreadonly string[]Free-form labels surfaced to operators and to the model.Tool.tagspackages/core/src/contracts/tool.ts:51
truncationStrategy?readonlyTruncationStrategyTruncation strategy applied when maxResultTokens is exceeded.Tool.truncationStrategypackages/core/src/contracts/tool.ts:104

Methods

execute()

ts
execute(input, ctx): Promise<
  | void
  | TOutput
| ToolReturn<TOutput>>;

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

Execute the tool. Concrete implementations may return either a raw TOutput or a ToolReturn<TOutput> envelope when extra content parts (images, files, …) need to be appended to the conversation. Streaming-hint tools may also return void once the per-chunk buffer has been populated.

Parameters

ParameterType
inputTInput
ctxToolExecutionContext&lt;TDeps&gt;

Returns

Promise< | void | TOutput | ToolReturn&lt;TOutput&gt;>

Inherited from

Tool.execute