mcprotocol_rs/server_features/
tools.rs1use async_trait::async_trait;
2use serde::{Deserialize, Serialize};
3use serde_json::Value;
4
5use crate::Result;
6
7#[derive(Debug, Clone, Serialize, Deserialize)]
9pub struct Tool {
10 pub id: String,
12 pub name: String,
14 pub description: String,
16 pub parameters: Value,
18 pub requires_approval: bool,
20}
21
22#[async_trait]
24pub trait ToolManager: Send + Sync {
25 async fn list_tools(&self) -> Result<Vec<Tool>>;
27
28 async fn get_tool(&self, id: &str) -> Result<Tool>;
30
31 async fn execute_tool(&self, id: &str, params: Value) -> Result<Value>;
33
34 async fn cancel_tool(&self, id: &str) -> Result<()>;
36}