use {
serde::{Deserialize, Serialize},
serde_json::Value,
std::collections::HashMap,
};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum McpServerStatus {
Disconnected,
Connecting,
Connected,
}
impl std::fmt::Display for McpServerStatus {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Disconnected => write!(f, "DISCONNECTED"),
Self::Connecting => write!(f, "CONNECTING"),
Self::Connected => write!(f, "CONNECTED"),
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct McpToolParam {
#[serde(rename = "type", default)]
pub param_type: String,
#[serde(default)]
pub description: String,
#[serde(default)]
pub required: bool,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub enum_values: Vec<Value>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct McpTool {
pub name: String,
pub fqn: String,
#[serde(default)]
pub description: String,
#[serde(default)]
pub params: HashMap<String, McpToolParam>,
#[serde(default)]
pub validate_required: bool,
}
#[derive(Debug, Clone)]
pub struct McpServerInfo {
pub name: String,
pub status: McpServerStatus,
pub description: String,
pub tools: Vec<McpTool>,
pub error: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct McpToolCall {
pub tool_fqn: String,
pub args: HashMap<String, Value>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct McpToolResult {
pub success: bool,
pub content: String,
pub data: Option<Value>,
pub error: Option<String>,
}