Creates a new FunctionTool wrapping the provided function.
The function to wrap
Rest...args: any[]Optionaloptions: { Optional configuration for the tool
Optionalname?: stringOptionaldescription?: stringOptionalisOptionalshouldOptionalmaxOptionalparameterName of the tool
Description of the tool
Whether the tool is a long running operation, which typically returns a resource id first and finishes the operation later.
Whether the tool execution should be retried on failure
Maximum retry attempts
Base delay for retry in ms (will be used with exponential backoff)
Maximum delay for retry in ms
ProtectedloggerProtectedapiGets the API variant for this tool
Processes the outgoing LLM request for this tool.
Use cases:
The outgoing LLM request, mutable by this method
Executes the tool with error handling and retries
Arguments for the tool
Tool execution context
Result of the tool execution or error information
Executes the wrapped function with the provided arguments.
A tool that wraps a user-defined TypeScript function.
This tool automatically generates a function declaration from the function's signature and documentation, making it easy to expose functions to agents.