Skip to content

ToolDefinition<InputSchema, ToolContext, Result> ​

ts
type ToolDefinition<InputSchema, ToolContext, Result> = object;

What you pass to defineTool.

Type Parameters ​

InputSchema ​

InputSchema extends ToolParameters = undefined

ToolContext ​

ToolContext = unknown

Result ​

Result = unknown

Properties ​

name ​

ts
name: string;

Shown to the AI, with every character other than letters and digits replaced by _.


description ​

ts
description: string;

Tells the AI what the tool does and when to use it.


parameters? ​

ts
optional parameters?: InputSchema;

Schema of execute's input. Omit it for a tool that takes no input: execute then receives undefined.


execute ​

ts
execute: ToolHandler<InputSchema, ToolContext, Result>;

Runs the tool; for a result tool, its return value becomes the decorated method's.


timeoutMs? ​

ts
optional timeoutMs?: number;

Deadline for one call, on top of the investigation's timeoutMs; the call fails with TrypatchTimeoutError.