mmcp_server/inventory.rs
1pub use ::inventory::*;
2
3use crate::primitives::tool::{BoxedTool, Tool};
4
5pub struct ToolRegistration {
6 constructor: fn() -> BoxedTool,
7}
8
9impl ToolRegistration {
10 pub const fn new<T: Tool + Default + Send + Sync + 'static>() -> Self {
11 Self {
12 constructor: || Box::new(T::default()),
13 }
14 }
15
16 pub fn tool(&self) -> BoxedTool {
17 (self.constructor)()
18 }
19}
20
21inventory::collect!(ToolRegistration);