Expand description
agent-fn-registry: one registry per LLM agent tool set.
Keeps the callable, schema, side-effect tags, and default args in one place instead of scattered parallel structures.
use agent_fn_registry::{Registry, ToolNotFoundError};
use serde_json::{json, Value};
let mut reg = Registry::new();
reg.register(
"echo",
|args: Value| args.get("msg").cloned().unwrap_or(Value::Null),
json!({"name": "echo", "description": "Echo a message.",
"input_schema": {"type": "object",
"properties": {"msg": {"type": "string"}},
"required": ["msg"]}}),
&["read"],
Some(json!({"msg": "hello"})),
);
let result = reg.dispatch("echo", Some(json!({"msg": "world"}))).unwrap();
assert_eq!(result, json!("world"));
let tools = reg.anthropic_tools();
assert_eq!(tools[0]["name"], json!("echo"));Structsยง
- Registry
- In-process registry of LLM agent tools.
- Tool
Entry - One registered tool.
- Tool
NotFound Error