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