traitclaw-macros 1.0.0

Proc macros for the TraitClaw AI Agent Framework
Documentation

traitclaw-macros

crates.io docs.rs

Proc macros for the TraitClaw AI Agent Framework.

Provides #[derive(Tool)] for generating type-safe tool implementations with automatic JSON schema generation from Rust structs.

Usage

use traitclaw::prelude::*;
use schemars::JsonSchema;
use serde::Deserialize;

#[derive(Tool)]
#[tool(description = "Search the web for information")]
struct WebSearch {
    /// The search query
    query: String,
    /// Maximum number of results
    max_results: Option<u32>,
}

The derive macro automatically:

  • Generates ErasedTool implementation
  • Creates JSON schema from struct fields and doc comments
  • Wires up serialization/deserialization

Note

Most users should use traitclaw with the macros feature (enabled by default) instead of depending on this crate directly.

License

Licensed under either of Apache License, Version 2.0 or MIT License at your option.