mcp_context_server/protocol/
request.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
5#[serde(untagged)]
6pub enum RpcId {
7 Number(i64),
8 Str(String),
9}
10
11#[derive(Debug, Clone, Deserialize)]
13pub struct JsonRpcRequest {
14 pub jsonrpc: String,
15 pub id: Option<RpcId>,
16 pub method: String,
17 pub params: Option<serde_json::Value>,
18}
19
20#[derive(Debug, Clone, Deserialize)]
22pub struct ResolveContextParams {
23 pub cache: String,
24 pub query: String,
25 pub budget: i64,
27}
28
29#[derive(Debug, Clone, Deserialize)]
31pub struct ListCachesParams {
32 pub root: String,
33}
34
35#[derive(Debug, Clone, Deserialize)]
37pub struct InspectCacheParams {
38 pub cache: String,
39}
40
41#[derive(Debug, Clone, Deserialize)]
43pub struct InitializeParams {
44 #[serde(rename = "protocolVersion")]
45 pub protocol_version: Option<String>,
46 #[serde(rename = "clientInfo")]
47 pub client_info: Option<ClientInfo>,
48}
49
50#[derive(Debug, Clone, Deserialize)]
52pub struct ClientInfo {
53 pub name: Option<String>,
54 pub version: Option<String>,
55}
56
57#[derive(Debug, Clone, Deserialize)]
59pub struct ToolCallParams {
60 pub name: String,
61 pub arguments: Option<serde_json::Value>,
62}