mcprotocol_rs/client_features/
mod.rs

1use async_trait::async_trait;
2use serde_json::Value;
3
4use crate::Result;
5
6/// Client configuration options
7#[derive(Debug, Clone)]
8pub struct ClientConfig {
9    /// Client name or identifier
10    pub name: String,
11    /// Client version
12    pub version: String,
13    /// Root directories for context
14    pub roots: Vec<String>,
15}
16
17/// Represents an MCP client
18#[async_trait]
19pub trait Client: Send + Sync {
20    /// Returns the client configuration
21    fn config(&self) -> &ClientConfig;
22
23    /// Handles a sampling request from the server
24    async fn handle_sampling(&self, prompt: Value) -> Result<Value>;
25
26    /// Provides context from root directories
27    async fn get_root_context(&self, path: &str) -> Result<Value>;
28}
29
30pub mod roots;
31pub mod sampling;