Skip to main content

neuron_tool

Attribute Macro neuron_tool 

Source
#[neuron_tool]
Expand description

Derive a Tool implementation from an async function.

§Example

#[neuron_tool(name = "calculate", description = "Evaluate a math expression")]
async fn calculate(
    /// A mathematical expression like "2 + 2"
    expression: String,
    _ctx: &ToolContext,
) -> Result<CalculateOutput, CalculateError> {
    let result = eval(&expression);
    Ok(CalculateOutput { result })
}