tools: unify channel and memory tools, clean up mcp-server

Move all tool definitions and dispatch out of mcp-server.rs:
- Channel tools: new tools/channels.rs with definitions, async
  dispatch, blocking dispatch, and capnp RPC helpers
- Memory tools: make tools/memory.rs pub so mcp-server can use it

mcp-server.rs is now pure JSON-RPC protocol plumbing (482 → 169 lines).
No tool-specific code remains in that file.

Also removes duplicated channel RPC helpers and fetch_all_channels
that were in both mcp-server.rs and thalamus/channels.rs.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
ProofOfConcept 2026-04-04 14:45:22 -04:00 committed by Kent Overstreet
parent 1ef137fb3a
commit 943f42d876
4 changed files with 392 additions and 352 deletions

View file

@ -6,10 +6,11 @@
// Core tools
mod bash;
pub mod channels;
mod edit;
mod glob;
mod grep;
mod memory;
pub mod memory;
mod read;
mod web;
mod write;
@ -191,6 +192,15 @@ pub async fn dispatch_shared(
});
}
// Channel tools
if name.starts_with("channel_") {
let result = channels::dispatch(name, args).await;
return Some(match result {
Ok(s) => ToolOutput::text(s),
Err(e) => ToolOutput::error(e),
});
}
// File and execution tools
let result = match name {
"read_file" => read::read_file(args),
@ -225,6 +235,7 @@ pub fn definitions() -> Vec<ToolDef> {
glob::definition(),
];
defs.extend(control::definitions());
defs.extend(channels::definitions());
defs.extend(memory::definitions());
defs
}