OptionaldescriptionAn optional description of what the tool does. Will be used by the language model to decide whether to use the tool.
Mandatory function that is called with the arguments from the tool call and produces a result. Always returns a Promise (not AsyncIterable).
The schema of the input that the tool expects. The language model will use this to generate the input. It is also used to validate the output of the language model.
OptionalonOptional function that is called when a tool call can be started, even if the execute function is not provided.
OptionalonOptional function that is called when an argument streaming delta is available. Only called when the tool is used in a streaming context.
OptionalonOptional function that is called when the argument streaming starts. Only called when the tool is used in a streaming context.
The schema of the output that the tool produces. This describes the ToolCallResult union type (success or failure).
OptionalproviderAdditional provider-specific metadata. They are passed through to the provider from the AI SDK and enable provider-specific functionality that can be fully encapsulated in the provider.
OptionaltoOptional conversion function that maps the tool result to an output that can be used by the language model. If not provided, the tool result will be sent as a JSON object.
Tool2Agent is a concrete type that represents a tool that can be used by an LLM. It is compatible with AI SDK's Tool type but: