Skip to main content

tool

Attribute Macro tool 

Source
#[tool]
Expand description

Attribute macro to define a tool from an async function.

§Usage

use agentic_tools_macros::tool;
use agentic_tools_core::ToolError;

#[tool(name = "my_tool", description = "Does something useful")]
async fn my_tool(input: MyInput) -> Result<MyOutput, ToolError> {
    // implementation
}

This generates a MyToolTool struct implementing the Tool trait.

§Attributes

  • name: The tool’s unique name (defaults to function name)
  • description: Human-readable description of what the tool does