#[rig_tool]derive only.Expand description
Generates a tool type, parameter struct, and uppercase static from a function
returning Result<T, E>. Functions with a mutable context implement
rig_core::tool::Tool; others implement rig_core::tool::PortableTool.
Imported context names need #[rig(context)]; qualified Rig paths are
recognized directly. The context is excluded from model arguments.
Accepts name, description, params(name = "description"), and
required(name, ...). Explicit names must start with an ASCII letter or _,
contain only ASCII letters, digits, _, or -, and be at most 64 bytes.
Description attributes override doc comments. Unknown or duplicate options
and parameter names are rejected.
Non-Option arguments are required by default. An explicit required list
makes omitted arguments default through serde, requiring Default.
Listing an Option argument as required is rejected.
use rig_derive::rig_tool;
#[rig_tool(description = "Add integers", params(a = "First operand"), required(a))]
fn add(a: i32, b: i32) -> Result<i32, rig_core::tool::ToolExecutionError> {
Ok(a + b)
}