tools: each module owns its Tool list, no duplication

Each tool module exports its own tools() returning Vec<Tool>.
mod.rs::tools() chains them. Individual _def() and handler functions
are pub(super), not exported. Aggregate definitions derived from
the Tool lists.

- memory: memory_tools(), journal_tools()
- channels: tools()
- control: tools()
- mod.rs: just chains + adds file/bash/web/vision

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
ProofOfConcept 2026-04-04 15:22:03 -04:00 committed by Kent Overstreet
parent aa7511d110
commit 6d6da07f91
4 changed files with 91 additions and 81 deletions

View file

@ -51,7 +51,16 @@ pub fn definitions() -> Vec<ToolDef> {
]
}
// ── Dispatch ───────────────────────────────────────────────────
pub fn tools() -> Vec<super::Tool> {
use super::Tool;
let defs = definitions();
vec![
Tool { def: defs[0].clone(), handler: |_a, _v| Box::pin(async move { channel_list().await }) },
Tool { def: defs[1].clone(), handler: |_a, v| Box::pin(async move { channel_recv(&v).await }) },
Tool { def: defs[2].clone(), handler: |_a, v| Box::pin(async move { channel_send(&v).await }) },
Tool { def: defs[3].clone(), handler: |_a, _v| Box::pin(async move { channel_notifications().await }) },
]
}
// ── Tool implementations ───────────────────────────────────────