cortexai-macros 0.1.0

Procedural macros for cortex framework
Documentation

Procedural Macros for cortex

This crate provides derive macros for easily defining tools and other agent components with minimal boilerplate.

Tool Derive Macro

use cortexai_macros::Tool;

#[derive(Tool)]
#[tool(name = "calculator", description = "Perform mathematical calculations")]
struct CalculatorTool {
    #[tool(param, required, description = "The mathematical expression to evaluate")]
    expression: String,

    #[tool(param, description = "Number of decimal places for result")]
    precision: Option<u32>,
}

impl CalculatorTool {
    async fn run(&self, expression: String, precision: Option<u32>) -> Result<serde_json::Value, String> {
        // Implementation here
        Ok(serde_json::json!(42.0))
    }
}