Skip to main content

aitool

Attribute Macro aitool 

Source
#[aitool]
Expand description

Attribute macro to register a free-standing Rust function as an AI tool.

Usage:

use reductool::aitool;

#[aitool]
/// Add two numbers
fn add(a: i32, b: i32) -> i32 { a + b }

Notes:

  • Only free functions are supported (no self receiver).
  • Parameters must be simple identifiers like arg: T. Patterns such as (_: T), (a, b): (T, U), or S { x, y }: S are rejected.
  • Optional parameters are expressed as Option<T> and will be omitted from the generated "required" list.
  • Supported parameter type mappings to JSON Schema are documented in this crate’s README under “Supported parameter types”.