Skip to main content

ToolResult

@forge/monorepo


@forge/monorepo / backend/src / ToolResult

Type Alias: ToolResult<T>

ToolResult<T> = { data: T; ok: true; ranToolName?: string; spilledOutputRef?: BlobRef; truncated?: boolean; } | { error: PlatformError; ok: false; ranToolName?: string; }

Defined in: backend/src/tools/index.ts:86

Shared success/error envelope — every tool, including imported ones.

ranToolName is set only when the call the model made is not the call that ran: execute_tool names its target, and without this the run event log records the indirection and loses the action. A destructive tool invoked that way would otherwise appear in the audit trail as "execute_tool", which is not an answer to the question an audit trail exists to answer.

Type Parameters

T

T = unknown

Union Members

Type Literal

{ data: T; ok: true; ranToolName?: string; spilledOutputRef?: BlobRef; truncated?: boolean; }

data

readonly data: T

ok

readonly ok: true

ranToolName?

readonly optional ranToolName?: string

spilledOutputRef?

readonly optional spilledOutputRef?: BlobRef

Set when the payload was compacted or spilled rather than returned inline.

truncated?

readonly optional truncated?: boolean


Type Literal

{ error: PlatformError; ok: false; ranToolName?: string; }