agnt-macros
Proc-macros for the agnt agent
runtime. Currently provides one attribute: #[tool].
use tool;
use ;
/// Add two integers and return their sum.
// Generates:
// pub struct Add;
// impl agnt_core::TypedTool for Add { const NAME = "add"; ... }
The first-line doc comment becomes the tool description. The PascalCase struct name is derived from the snake_case fn name. The generated impl forwards to the original function, which is left in place so you can still call it directly from Rust.
⚠️ v0.3.x limitation
The generated schema() returns a bare {"type": "object"} with no
field metadata — the model cannot see your argument names or types
from the schema alone and must infer them from the description. For
any non-trivial tool, hand-writing a TypedTool impl where you
control schema() is currently still better UX.
Real JSON Schema derivation (via schemars) is planned for v0.4
behind an opt-in #[tool(schema = schemars)] attribute.
Requirements
- Exactly one argument whose type becomes
TypedTool::Args - Return type must be
Result<Output, Error> - A doc comment is strongly recommended (becomes the description)
See the flagship agnt crate for the
agent runtime this plugs into, or the
repository for the broader project.
License
Dual-licensed under MIT OR Apache-2.0.