Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/generated_schema/2024_11_05/mcp_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
/// modify or extend the implementations as needed, but please do so at your own risk.
///
/// Generated from : <https://github.com/modelcontextprotocol/specification.git>
/// Hash : 0b3a76e5b39abca1c865af9ce1565a98e59dfab1
/// Generated at : 2026-01-22 09:32:57
/// Hash : e14831553a82c059d6e2fc866084b26e82ae791a
/// Generated at : 2026-03-10 19:10:27
/// ----------------------------------------------------------------------------
///
use super::validators as validate;
Expand Down
16 changes: 12 additions & 4 deletions src/generated_schema/2024_11_05/schema_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,15 @@ impl Hash for RequestId {
}
}

impl core::fmt::Display for RequestId {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match *self {
RequestId::String(ref s) => write!(f, "{}", s),
RequestId::Integer(i) => write!(f, "{}", i),
}
}
}

//*******************//
//** ClientMessage **//
//*******************//
Expand Down Expand Up @@ -239,7 +248,7 @@ impl ClientMessage {

/// Returns `true` if the message is an `InitializedNotification`
pub fn is_initialized_notification(&self) -> bool {
matches!(self, Self::Notification(notofication) if notofication.notification.is_initialized_notification())
matches!(self, Self::Notification(notification) if notification.notification.is_initialized_notification())
}
}

Expand Down Expand Up @@ -1330,7 +1339,7 @@ impl MessageFromClient {

/// Returns `true` if the message is an `InitializedNotification`
pub fn is_initialized_notification(&self) -> bool {
matches!(self, Self::NotificationFromClient(notofication) if notofication.is_initialized_notification())
matches!(self, Self::NotificationFromClient(notification) if notification.is_initialized_notification())
}
}

Expand Down Expand Up @@ -1479,7 +1488,7 @@ impl CallToolError {
let message = message.unwrap_or(default_message);

// Format the full error message
let full_message = format!("Invalid arguments for tool '{tool_name}': {message}" );
let full_message = format!("Invalid arguments for tool '{tool_name}': {message}");

Self::from_message(full_message)
}
Expand Down Expand Up @@ -1521,7 +1530,6 @@ impl CallToolError {
}
}


/// Converts a `CallToolError` into a `RpcError`.
///
/// The conversion creates an internal error variant of `RpcError`
Expand Down
4 changes: 2 additions & 2 deletions src/generated_schema/2025_03_26/mcp_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
/// modify or extend the implementations as needed, but please do so at your own risk.
///
/// Generated from : <https://github.com/modelcontextprotocol/specification.git>
/// Hash : 0b3a76e5b39abca1c865af9ce1565a98e59dfab1
/// Generated at : 2026-01-22 09:32:59
/// Hash : e14831553a82c059d6e2fc866084b26e82ae791a
/// Generated at : 2026-03-10 19:10:29
/// ----------------------------------------------------------------------------
///
use super::validators as validate;
Expand Down
15 changes: 11 additions & 4 deletions src/generated_schema/2025_03_26/schema_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ impl Hash for RequestId {
}
}

impl core::fmt::Display for RequestId {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match *self {
RequestId::String(ref s) => write!(f, "{}", s),
RequestId::Integer(i) => write!(f, "{}", i),
}
}
}
//*******************//
//** ClientMessage **//
//*******************//
Expand Down Expand Up @@ -239,7 +247,7 @@ impl ClientMessage {

/// Returns `true` if the message is an `InitializedNotification`
pub fn is_initialized_notification(&self) -> bool {
matches!(self, Self::Notification(notofication) if notofication.notification.is_initialized_notification())
matches!(self, Self::Notification(notification) if notification.notification.is_initialized_notification())
}
}

Expand Down Expand Up @@ -1330,7 +1338,7 @@ impl MessageFromClient {

/// Returns `true` if the message is an `InitializedNotification`
pub fn is_initialized_notification(&self) -> bool {
matches!(self, Self::NotificationFromClient(notofication) if notofication.is_initialized_notification())
matches!(self, Self::NotificationFromClient(notification) if notification.is_initialized_notification())
}
}

Expand Down Expand Up @@ -1479,7 +1487,7 @@ impl CallToolError {
let message = message.unwrap_or(default_message);

// Format the full error message
let full_message = format!("Invalid arguments for tool '{tool_name}': {message}" );
let full_message = format!("Invalid arguments for tool '{tool_name}': {message}");

Self::from_message(full_message)
}
Expand Down Expand Up @@ -1521,7 +1529,6 @@ impl CallToolError {
}
}


/// Converts a `CallToolError` into a `RpcError`.
///
/// The conversion creates an internal error variant of `RpcError`
Expand Down
4 changes: 2 additions & 2 deletions src/generated_schema/2025_06_18/mcp_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
/// modify or extend the implementations as needed, but please do so at your own risk.
///
/// Generated from : <https://github.com/modelcontextprotocol/specification.git>
/// Hash : 0b3a76e5b39abca1c865af9ce1565a98e59dfab1
/// Generated at : 2026-01-22 09:33:00
/// Hash : e14831553a82c059d6e2fc866084b26e82ae791a
/// Generated at : 2026-03-10 19:10:29
/// ----------------------------------------------------------------------------
///
use super::validators as validate;
Expand Down
12 changes: 10 additions & 2 deletions src/generated_schema/2025_06_18/schema_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@ impl Hash for RequestId {
}
}

impl core::fmt::Display for RequestId {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match *self {
RequestId::String(ref s) => write!(f, "{}", s),
RequestId::Integer(i) => write!(f, "{}", i),
}
}
}
//*******************//
//** ClientMessage **//
//*******************//
Expand Down Expand Up @@ -238,7 +246,7 @@ impl ClientMessage {

/// Returns `true` if the message is an `InitializedNotification`
pub fn is_initialized_notification(&self) -> bool {
matches!(self, Self::Notification(notofication) if notofication.notification.is_initialized_notification())
matches!(self, Self::Notification(notification) if notification.notification.is_initialized_notification())
}
}

Expand Down Expand Up @@ -1331,7 +1339,7 @@ impl MessageFromClient {

/// Returns `true` if the message is an `InitializedNotification`
pub fn is_initialized_notification(&self) -> bool {
matches!(self, Self::NotificationFromClient(notofication) if notofication.is_initialized_notification())
matches!(self, Self::NotificationFromClient(notification) if notification.is_initialized_notification())
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/generated_schema/2025_11_25/mcp_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
/// modify or extend the implementations as needed, but please do so at your own risk.
///
/// Generated from : <https://github.com/modelcontextprotocol/specification.git>
/// Hash : 0b3a76e5b39abca1c865af9ce1565a98e59dfab1
/// Generated at : 2026-01-22 09:33:00
/// Hash : e14831553a82c059d6e2fc866084b26e82ae791a
/// Generated at : 2026-03-10 19:10:30
/// ----------------------------------------------------------------------------
///
use super::validators as validate;
Expand Down
53 changes: 53 additions & 0 deletions src/generated_schema/2025_11_25/schema_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ fn detect_message_type(value: &serde_json::Value) -> MessageTypes {
pub trait RpcMessage: McpMessage {
fn request_id(&self) -> Option<&RequestId>;
fn jsonrpc(&self) -> &str;
fn method(&self) -> Option<&str>;
}

pub trait McpMessage {
Expand Down Expand Up @@ -133,6 +134,14 @@ impl Hash for RequestId {
}
}

impl core::fmt::Display for RequestId {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match *self {
RequestId::String(ref s) => write!(f, "{}", s),
RequestId::Integer(i) => write!(f, "{}", i),
}
}
}
//*******************//
//** ClientMessage **//
//*******************//
Expand Down Expand Up @@ -307,6 +316,15 @@ impl RpcMessage for ClientMessage {
ClientMessage::Error(jsonrpc_error) => jsonrpc_error.jsonrpc(),
}
}

fn method(&self) -> Option<&str> {
match self {
ClientMessage::Request(client_jsonrpc_request) => Some(client_jsonrpc_request.method()),
ClientMessage::Notification(client_jsonrpc_notification) => Some(client_jsonrpc_notification.method()),
ClientMessage::Response(_) => None,
ClientMessage::Error(_) => None,
}
}
}

// Implementing the `McpMessage` trait for `ClientMessage`
Expand Down Expand Up @@ -693,6 +711,17 @@ impl ClientJsonrpcNotification {
pub fn is_initialized_notification(&self) -> bool {
matches!(self, Self::InitializedNotification(_))
}

pub fn method(&self) -> &str {
match self {
ClientJsonrpcNotification::CancelledNotification(notification) => notification.method(),
ClientJsonrpcNotification::InitializedNotification(notification) => notification.method(),
ClientJsonrpcNotification::ProgressNotification(notification) => notification.method(),
ClientJsonrpcNotification::TaskStatusNotification(notification) => notification.method(),
ClientJsonrpcNotification::RootsListChangedNotification(notification) => notification.method(),
ClientJsonrpcNotification::CustomNotification(notification) => notification.method.as_str(),
}
}
}

impl From<ClientJsonrpcNotification> for NotificationFromClient {
Expand Down Expand Up @@ -1070,6 +1099,15 @@ impl RpcMessage for ServerMessage {
ServerMessage::Error(jsonrpc_error) => jsonrpc_error.jsonrpc(),
}
}

fn method(&self) -> Option<&str> {
match self {
ServerMessage::Request(server_jsonrpc_request) => Some(server_jsonrpc_request.method()),
ServerMessage::Notification(server_jsonrpc_notification) => Some(server_jsonrpc_notification.method()),
ServerMessage::Response(_) => None,
ServerMessage::Error(_) => None,
}
}
}

// Implementing the `McpMessage` trait for `ServerMessage`
Expand Down Expand Up @@ -1406,6 +1444,21 @@ impl ServerJsonrpcNotification {
ServerJsonrpcNotification::CustomNotification(notification) => notification.jsonrpc(),
}
}

fn method(&self) -> &str {
match self {
ServerJsonrpcNotification::CancelledNotification(notification) => notification.method(),
ServerJsonrpcNotification::ProgressNotification(notification) => notification.method(),
ServerJsonrpcNotification::ResourceListChangedNotification(notification) => notification.method(),
ServerJsonrpcNotification::ResourceUpdatedNotification(notification) => notification.method(),
ServerJsonrpcNotification::PromptListChangedNotification(notification) => notification.method(),
ServerJsonrpcNotification::ToolListChangedNotification(notification) => notification.method(),
ServerJsonrpcNotification::TaskStatusNotification(notification) => notification.method(),
ServerJsonrpcNotification::LoggingMessageNotification(notification) => notification.method(),
ServerJsonrpcNotification::ElicitationCompleteNotification(notification) => notification.method(),
ServerJsonrpcNotification::CustomNotification(notification) => &notification.method,
}
}
}

/// Formats the ServerJsonrpcNotification as a JSON string.
Expand Down
Loading