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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ fn handle_message(message_payload: &str) -> std::result::Result<(), AppError> {
// Check it's a Request type of message
if let JsonrpcMessage::Request(client_message) = message {

// Check method to detect it it a "initialize" request
// Check method to detect is a "initialize" request
if client_message.method == "initialize" {

// Now that we can handle the message, we simply print out the details.
Expand Down
12 changes: 10 additions & 2 deletions src/generated_schema/2024_11_05/mcp_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,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 : 3d4877e69cbc9921e1b511a90cdf17d42483036b
/// Generated at : 2025-02-09 20:40:09
/// Hash : 55c983fd85fafa458d31f729e433c60e95932178
/// Generated at : 2025-02-11 20:13:30
/// ----------------------------------------------------------------------------
///
/// MCP Protocol Version
Expand Down Expand Up @@ -4542,6 +4542,14 @@ pub struct Result {
#[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
impl ::std::default::Default for Result {
fn default() -> Self {
Self {
meta: Default::default(),
extra: Default::default(),
}
}
}
///The sender or recipient of messages and data in a conversation.
///
/// <details><summary>JSON schema</summary>
Expand Down
79 changes: 79 additions & 0 deletions src/generated_schema/2024_11_05/schema_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,17 @@ impl ClientJsonrpcRequest {
}
}

/// Formats the ClientJsonrpcRequest as a JSON string.
impl Display for ClientJsonrpcRequest {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}",
serde_json::to_string(self).unwrap_or_else(|err| format!("Serialization error: {}", err))
)
}
}

//*************************//
//** Request From Client **//
//*************************//
Expand Down Expand Up @@ -150,6 +161,17 @@ impl ClientJsonrpcNotification {
}
}

/// Formats the ClientJsonrpcNotification as a JSON string.
impl Display for ClientJsonrpcNotification {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}",
serde_json::to_string(self).unwrap_or_else(|err| format!("Serialization error: {}", err))
)
}
}

//*******************************//
//** NotificationFromClient **//
//*******************************//
Expand Down Expand Up @@ -210,6 +232,17 @@ impl ClientJsonrpcResponse {
}
}

/// Formats the ClientJsonrpcResponse as a JSON string.
impl Display for ClientJsonrpcResponse {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}",
serde_json::to_string(self).unwrap_or_else(|err| format!("Serialization error: {}", err))
)
}
}

//*******************************//
//** ResultFromClient **//
//*******************************//
Expand Down Expand Up @@ -331,6 +364,16 @@ impl ServerJsonrpcRequest {
}
}

/// Formats the ServerJsonrpcRequest as a JSON string.
impl Display for ServerJsonrpcRequest {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}",
serde_json::to_string(self).unwrap_or_else(|err| format!("Serialization error: {}", err))
)
}
}
//*************************//
//** Request From Server **//
//*************************//
Expand Down Expand Up @@ -404,6 +447,16 @@ impl ServerJsonrpcNotification {
}
}

/// Formats the ServerJsonrpcNotification as a JSON string.
impl Display for ServerJsonrpcNotification {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}",
serde_json::to_string(self).unwrap_or_else(|err| format!("Serialization error: {}", err))
)
}
}
//*******************************//
//** NotificationFromServer **//
//*******************************//
Expand Down Expand Up @@ -464,6 +517,17 @@ impl ServerJsonrpcResponse {
}
}

/// Formats the ServerJsonrpcResponse as a JSON string.
impl Display for ServerJsonrpcResponse {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}",
serde_json::to_string(self).unwrap_or_else(|err| format!("Serialization error: {}", err))
)
}
}

//*******************************//
//** ResultFromServer **//
//*******************************//
Expand Down Expand Up @@ -511,6 +575,21 @@ impl<'de> serde::Deserialize<'de> for ResultFromServer {
}
}

//***************************//
//** impl for JsonrpcError **//
//***************************//

/// Formats the ServerJsonrpcResponse as a JSON string.
impl Display for JsonrpcError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}",
serde_json::to_string(self).unwrap_or_else(|err| format!("Serialization error: {}", err))
)
}
}

/// BEGIN AUTO GENERATED
impl ::serde::Serialize for ClientJsonrpcRequest {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
Expand Down
12 changes: 10 additions & 2 deletions src/generated_schema/draft/mcp_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,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 : 3d4877e69cbc9921e1b511a90cdf17d42483036b
/// Generated at : 2025-02-09 20:40:10
/// Hash : 55c983fd85fafa458d31f729e433c60e95932178
/// Generated at : 2025-02-11 20:13:30
/// ----------------------------------------------------------------------------
///
/// MCP Protocol Version
Expand Down Expand Up @@ -4673,6 +4673,14 @@ pub struct Result {
#[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
impl ::std::default::Default for Result {
fn default() -> Self {
Self {
meta: Default::default(),
extra: Default::default(),
}
}
}
///The sender or recipient of messages and data in a conversation.
///
/// <details><summary>JSON schema</summary>
Expand Down
79 changes: 79 additions & 0 deletions src/generated_schema/draft/schema_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,17 @@ impl ClientJsonrpcRequest {
}
}

/// Formats the ClientJsonrpcRequest as a JSON string.
impl Display for ClientJsonrpcRequest {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}",
serde_json::to_string(self).unwrap_or_else(|err| format!("Serialization error: {}", err))
)
}
}

//*************************//
//** Request From Client **//
//*************************//
Expand Down Expand Up @@ -150,6 +161,17 @@ impl ClientJsonrpcNotification {
}
}

/// Formats the ClientJsonrpcNotification as a JSON string.
impl Display for ClientJsonrpcNotification {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}",
serde_json::to_string(self).unwrap_or_else(|err| format!("Serialization error: {}", err))
)
}
}

//*******************************//
//** NotificationFromClient **//
//*******************************//
Expand Down Expand Up @@ -210,6 +232,17 @@ impl ClientJsonrpcResponse {
}
}

/// Formats the ClientJsonrpcResponse as a JSON string.
impl Display for ClientJsonrpcResponse {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}",
serde_json::to_string(self).unwrap_or_else(|err| format!("Serialization error: {}", err))
)
}
}

//*******************************//
//** ResultFromClient **//
//*******************************//
Expand Down Expand Up @@ -331,6 +364,16 @@ impl ServerJsonrpcRequest {
}
}

/// Formats the ServerJsonrpcRequest as a JSON string.
impl Display for ServerJsonrpcRequest {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}",
serde_json::to_string(self).unwrap_or_else(|err| format!("Serialization error: {}", err))
)
}
}
//*************************//
//** Request From Server **//
//*************************//
Expand Down Expand Up @@ -404,6 +447,16 @@ impl ServerJsonrpcNotification {
}
}

/// Formats the ServerJsonrpcNotification as a JSON string.
impl Display for ServerJsonrpcNotification {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}",
serde_json::to_string(self).unwrap_or_else(|err| format!("Serialization error: {}", err))
)
}
}
//*******************************//
//** NotificationFromServer **//
//*******************************//
Expand Down Expand Up @@ -464,6 +517,17 @@ impl ServerJsonrpcResponse {
}
}

/// Formats the ServerJsonrpcResponse as a JSON string.
impl Display for ServerJsonrpcResponse {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}",
serde_json::to_string(self).unwrap_or_else(|err| format!("Serialization error: {}", err))
)
}
}

//*******************************//
//** ResultFromServer **//
//*******************************//
Expand Down Expand Up @@ -511,6 +575,21 @@ impl<'de> serde::Deserialize<'de> for ResultFromServer {
}
}

//***************************//
//** impl for JsonrpcError **//
//***************************//

/// Formats the ServerJsonrpcResponse as a JSON string.
impl Display for JsonrpcError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}",
serde_json::to_string(self).unwrap_or_else(|err| format!("Serialization error: {}", err))
)
}
}

/// BEGIN AUTO GENERATED
impl ::serde::Serialize for ClientJsonrpcRequest {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
Expand Down