pub trait Tool {
// Required methods
fn description(&self) -> ToolDescription;
fn invoke(&self, input: Value) -> Result<Value, ToolUseError>;
// Provided method
fn matches(&self, name: &str) -> bool { ... }
}
Expand description
The Tool
trait defines an interface for tools that can be added to a ToolCollection
.
A Tool
is a function that takes a YAML-formatted input and returns a YAML-formatted output.
It has a description that contains metadata about the tool, such as its name and usage.
Required Methods§
sourcefn description(&self) -> ToolDescription
fn description(&self) -> ToolDescription
Returns the ToolDescription
containing metadata about the tool.