Skip to main content

tool

Attribute Macro tool 

Source
#[tool]
Expand description

The #[tool] procedural macro.

Transforms a function into a full Tool implementation.

§Attributes

  • #[tool(description = "...")] — Required. The tool description shown to the LLM.
  • #[param(desc = "...")] — Optional per-parameter. Adds description to the JSON schema.

§Parameter Rules

  • String, i64, f64, bool → required in schema
  • Option<T> → optional in schema
  • Vec<T> → array in schema