mcp_protocol/
version.rs

1// mcp-protocol/src/version.rs
2use serde::{Deserialize, Serialize};
3
4/// Error returned when protocol versions don't match
5#[derive(Debug, Clone, Serialize, Deserialize)]
6pub struct VersionMismatchError {
7    pub supported: Vec<String>,
8    pub requested: String,
9}
10
11/// Check if a protocol version is supported
12pub fn is_supported_version(version: &str) -> bool {
13    // For now, only support the current version
14    version == crate::constants::PROTOCOL_VERSION
15}
16
17/// Get information for a version mismatch error
18pub fn version_mismatch_error(requested: &str) -> VersionMismatchError {
19    VersionMismatchError {
20        supported: vec![crate::constants::PROTOCOL_VERSION.to_string()],
21        requested: requested.to_string(),
22    }
23}