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?
optionalcapability?:ToolCapability
Defined in: packages/core/src/utils/tools.ts:220
Undeclared: 'both', so a read-only mode leaves the tool out.
Inherited from
childRun?
optionalchildRun?: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
description
description:
string
Defined in: packages/core/src/utils/tools.ts:316
display?
optionaldisplay?:ToolDisplay<unknown>
Defined in: packages/core/src/utils/tools.ts:218
Inherited from
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?
optionalreconcile?: (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
replay?
optionalreplay?: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
timeoutMs?
optionaltimeoutMs?: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
version?
optionalversion?:string
Defined in: packages/core/src/utils/tools.ts:104
Semantic version. Required only for strict durability.
Inherited from
Methods
describeApproval()?
optionaldescribeApproval(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