Natural-language description that tells the model when to use this tool.
Called when the model invokes the tool. Receives the parsed arguments (an
empty object when parameters is omitted) and a RunContext
(ctx); the returned value is sent back to the model.
Optional flags?: numberBitmask of ToolFlags, e.g. ToolFlag.CANCELLABLE to allow the call
to be cancelled mid-flight. Defaults to ToolFlag.NONE.
Unique name the model calls the tool by. Must be non-empty.
Optional onHow a concurrent duplicate call of this tool is handled while one is still
running: 'allow' | 'reject' | 'replace' | 'confirm'. Defaults to
'allow'.
Optional parameters?: SchemaInput schema for the tool's arguments — either a Zod object schema (args are type-inferred) or a raw JSON Schema. Omit for a tool that takes no arguments.
Create an anonymous (name-less) function tool. Parameters are inferred from the schema; omit
parameters for a tool that takes no arguments.
Natural-language description that tells the model when to use this tool.
Called when the model invokes the tool. Receives the parsed arguments (an
empty object when parameters is omitted) and a RunContext
(ctx); the returned value is sent back to the model.
Optional flags?: numberBitmask of ToolFlags, e.g. ToolFlag.CANCELLABLE to allow the call
to be cancelled mid-flight. Defaults to ToolFlag.NONE.
Optional name?: undefinedOmitted in object syntax; the containing object key becomes the tool name.
Optional onHow a concurrent duplicate call of this tool is handled while one is still
running: 'allow' | 'reject' | 'replace' | 'confirm'. Defaults to
'allow'.
Optional parameters?: SchemaInput schema for the tool's arguments — either a Zod object schema (args are type-inferred) or a raw JSON Schema. Omit for a tool that takes no arguments.
Create a function tool. Parameters are inferred from the schema; omit
parametersfor a tool that takes no arguments.