Skip to main content

Interface: ToolDefinition<T>

Defined in: packages/core/src/utils/tools.ts:314

A tool whose input is described by a JSON Schema.

Example​

const weatherTool: ToolDefinition = {
name: 'get_weather',
description: 'Get weather info',
inputSchema: {
type: 'object',
properties: {
location: { type: 'string', description: 'City name' }
},
required: ['location']
},
execute: async ({ location }) => {
return { temp: 22, condition: 'sunny' };
}
};

Extends​

Type Parameters​

T​

T extends (...args) => unknown = (...args) => unknown

Properties​

capability?​

optional capability?: ToolCapability

Defined in: packages/core/src/utils/tools.ts:220

Undeclared: 'both', so a read-only mode leaves the tool out.

Inherited from​

ToolPresentation.capability


childRun?​

optional childRun?: boolean

Defined in: packages/core/src/utils/tools.ts:119

The tool runs a child loop (a subagent) inside its call. Its own loop has its own limits, so the call gets no tool limit unless it declares timeoutMs, and the parent's loop needs the place's childRecovery. A Processable tool runs one without declaring it. See declareChildRun().

Inherited from​

ToolDurability.childRun


description​

description: string

Defined in: packages/core/src/utils/tools.ts:316


display?​

optional display?: ToolDisplay<unknown>

Defined in: packages/core/src/utils/tools.ts:218

Inherited from​

ToolPresentation.display


execute​

execute: T

Defined in: packages/core/src/utils/tools.ts:318


inputSchema​

inputSchema: JsonSchema

Defined in: packages/core/src/utils/tools.ts:317


name​

name: string

Defined in: packages/core/src/utils/tools.ts:315


reconcile?​

optional reconcile?: (toolCallId, input) => Promise<EffectReconciliation<unknown>>

Defined in: packages/core/src/utils/tools.ts:102

What an interrupted call did, looked up by its toolCallId.

Parameters​

toolCallId​

string

input​

unknown

Returns​

Promise<EffectReconciliation<unknown>>

Inherited from​

ToolDurability.reconcile


replay?​

optional replay?: ToolReplay

Defined in: packages/core/src/utils/tools.ts:100

'safe': may run again with the same toolCallId. 'unsafe': never runs again without reconciling.

Inherited from​

ToolDurability.replay


timeoutMs?​

optional timeoutMs?: number | false

Defined in: packages/core/src/utils/tools.ts:112

This tool's limit per call in a checkpointed durable loop, in milliseconds from the call's start (AI SDK timeout.tools): past it the call's abortSignal aborts and the call ends as a tool error. false: no limit. Unset: the run's RunPolicy.toolTimeoutMs, else its stepIdleTimeoutMs. Wins over childRun, so a host can bound a child loop too.

Inherited from​

ToolDurability.timeoutMs


version?​

optional version?: string

Defined in: packages/core/src/utils/tools.ts:104

Semantic version. Required only for strict durability.

Inherited from​

ToolDurability.version

Methods​

describeApproval()?​

optional describeApproval(input): ToolApprovalSummary | undefined

Defined in: packages/core/src/utils/tools.ts:222

Describes a call that needs approval (see requiresApproval).

Parameters​

input​

unknown

Returns​

ToolApprovalSummary | undefined

Inherited from​

ToolPresentation.describeApproval