rust_mcp_schema/generated_schema/
protocol_version.rs

1use std::fmt::Display;
2#[derive(Debug, PartialEq, Eq)]
3pub enum ProtocolVersion {
4    V2024_11_05,
5    V2025_03_26,
6    V2025_06_18,
7    Draft,
8}
9impl Display for ProtocolVersion {
10    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11        match self {
12            ProtocolVersion::V2024_11_05 => write!(f, "2024-11-05"),
13            ProtocolVersion::V2025_03_26 => write!(f, "2025-03-26"),
14            ProtocolVersion::V2025_06_18 => write!(f, "2025-06-18"),
15            ProtocolVersion::Draft => write!(f, "DRAFT-2025-v3"),
16        }
17    }
18}
19#[derive(Debug)]
20pub struct ParseProtocolVersionError {
21    details: String,
22}
23impl std::fmt::Display for ParseProtocolVersionError {
24    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
25        write!(f, "Protocol version parse error: {}", self.details)
26    }
27}
28impl std::error::Error for ParseProtocolVersionError {}
29impl TryFrom<&str> for ProtocolVersion {
30    type Error = ParseProtocolVersionError;
31    fn try_from(value: &str) -> Result<Self, Self::Error> {
32        match value {
33            "2024-11-05" => Ok(ProtocolVersion::V2024_11_05),
34            "2025-03-26" => Ok(ProtocolVersion::V2025_03_26),
35            "2025-06-18" => Ok(ProtocolVersion::V2025_06_18),
36            "DRAFT-2025-v3" => Ok(ProtocolVersion::Draft),
37            other => Err(ParseProtocolVersionError {
38                details: other.to_string(),
39            }),
40        }
41    }
42}