Tool
class defines a tool that can be attached to an Agent.
Constructor
TheTool
constructor accepts a configuration object with the following properties:
The name of the tool. Must be alphanumeric.
A plain-text description of what the tool does. This should be as expressive as possible,
to help explain to your agent what the tool can be used for.
An optional hash of parameters, each of which should be a Zod schema describing the parameter’s type.
Your agent will use these schemas to determine the right format in which to pass arguments to the tool.
If you omit this, your tool will receive no arguments.
An optional Zod schema describing the type of the value returned by the tool’s
execute()
function.
If you omit this, your tool can return a value of any type.The function which will be called when your agent decides to use the tool. The function
receives two arguments:
- A hash of arguments matching the shape specified in
parameters
. - A Context which provides access to platform functionality.
result
schema.