Skip to content

Commit 71e63e5

Browse files
authored
feat: implement builder pattern for JsonrpcErrorError (#18)
* feat: implement builder pattern for JsonrpcErrorError * chore: improve test coverage * chore: clippy fix
1 parent 5f84670 commit 71e63e5

File tree

5 files changed

+734
-26
lines changed

5 files changed

+734
-26
lines changed

src/generated_schema/2024_11_05/mcp_schema.rs

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/// ----------------------------------------------------------------------------
2-
/// This file is auto-generated by mcp-schema-gen v0.1.1.
2+
/// This file is auto-generated by mcp-schema-gen v0.1.3.
33
/// WARNING:
44
/// It is not recommended to modify this file directly. You are free to
55
/// modify or extend the implementations as needed, but please do so at your own risk.
66
///
77
/// Generated from : <https://github.com/modelcontextprotocol/specification.git>
8-
/// Hash : 55c983fd85fafa458d31f729e433c60e95932178
9-
/// Generated at : 2025-02-11 20:13:30
8+
/// Hash : 63e1dbb75456b359b9ed8b27d21f4ac68cbb753e
9+
/// Generated at : 2025-02-14 07:43:44
1010
/// ----------------------------------------------------------------------------
1111
///
1212
/// MCP Protocol Version
@@ -4542,7 +4542,6 @@ pub struct Result {
45424542
#[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
45434543
pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
45444544
}
4545-
45464545
///The sender or recipient of messages and data in a conversation.
45474546
///
45484547
/// <details><summary>JSON schema</summary>
@@ -5763,6 +5762,7 @@ impl<'de> serde::Deserialize<'de> for ClientRequest {
57635762
}
57645763
}
57655764
impl ClientRequest {
5765+
#[deprecated(since = "0.1.4", note = "Use `method()` instead.")]
57665766
pub fn get_method(&self) -> &str {
57675767
match self {
57685768
ClientRequest::InitializeRequest(request) => request.method(),
@@ -5780,6 +5780,23 @@ impl ClientRequest {
57805780
ClientRequest::CompleteRequest(request) => request.method(),
57815781
}
57825782
}
5783+
pub fn method(&self) -> &str {
5784+
match self {
5785+
ClientRequest::InitializeRequest(request) => request.method(),
5786+
ClientRequest::PingRequest(request) => request.method(),
5787+
ClientRequest::ListResourcesRequest(request) => request.method(),
5788+
ClientRequest::ListResourceTemplatesRequest(request) => request.method(),
5789+
ClientRequest::ReadResourceRequest(request) => request.method(),
5790+
ClientRequest::SubscribeRequest(request) => request.method(),
5791+
ClientRequest::UnsubscribeRequest(request) => request.method(),
5792+
ClientRequest::ListPromptsRequest(request) => request.method(),
5793+
ClientRequest::GetPromptRequest(request) => request.method(),
5794+
ClientRequest::ListToolsRequest(request) => request.method(),
5795+
ClientRequest::CallToolRequest(request) => request.method(),
5796+
ClientRequest::SetLevelRequest(request) => request.method(),
5797+
ClientRequest::CompleteRequest(request) => request.method(),
5798+
}
5799+
}
57835800
}
57845801
/// Implementing the Deserialize trait
57855802
/// This allows enum to be deserialized into correct type based on the value of the "method"
@@ -5817,6 +5834,7 @@ impl<'de> serde::Deserialize<'de> for ClientNotification {
58175834
}
58185835
}
58195836
impl ClientNotification {
5837+
#[deprecated(since = "0.1.4", note = "Use `method()` instead.")]
58205838
pub fn get_method(&self) -> &str {
58215839
match self {
58225840
ClientNotification::CancelledNotification(request) => request.method(),
@@ -5825,6 +5843,14 @@ impl ClientNotification {
58255843
ClientNotification::RootsListChangedNotification(request) => request.method(),
58265844
}
58275845
}
5846+
pub fn method(&self) -> &str {
5847+
match self {
5848+
ClientNotification::CancelledNotification(request) => request.method(),
5849+
ClientNotification::InitializedNotification(request) => request.method(),
5850+
ClientNotification::ProgressNotification(request) => request.method(),
5851+
ClientNotification::RootsListChangedNotification(request) => request.method(),
5852+
}
5853+
}
58285854
}
58295855
/// Implementing the Deserialize trait
58305856
/// This allows enum to be deserialized into correct type based on the value of the "method"
@@ -5857,13 +5883,21 @@ impl<'de> serde::Deserialize<'de> for ServerRequest {
58575883
}
58585884
}
58595885
impl ServerRequest {
5886+
#[deprecated(since = "0.1.4", note = "Use `method()` instead.")]
58605887
pub fn get_method(&self) -> &str {
58615888
match self {
58625889
ServerRequest::PingRequest(request) => request.method(),
58635890
ServerRequest::CreateMessageRequest(request) => request.method(),
58645891
ServerRequest::ListRootsRequest(request) => request.method(),
58655892
}
58665893
}
5894+
pub fn method(&self) -> &str {
5895+
match self {
5896+
ServerRequest::PingRequest(request) => request.method(),
5897+
ServerRequest::CreateMessageRequest(request) => request.method(),
5898+
ServerRequest::ListRootsRequest(request) => request.method(),
5899+
}
5900+
}
58675901
}
58685902
/// Implementing the Deserialize trait
58695903
/// This allows enum to be deserialized into correct type based on the value of the "method"
@@ -5917,6 +5951,7 @@ impl<'de> serde::Deserialize<'de> for ServerNotification {
59175951
}
59185952
}
59195953
impl ServerNotification {
5954+
#[deprecated(since = "0.1.4", note = "Use `method()` instead.")]
59205955
pub fn get_method(&self) -> &str {
59215956
match self {
59225957
ServerNotification::CancelledNotification(request) => request.method(),
@@ -5928,4 +5963,15 @@ impl ServerNotification {
59285963
ServerNotification::LoggingMessageNotification(request) => request.method(),
59295964
}
59305965
}
5966+
pub fn method(&self) -> &str {
5967+
match self {
5968+
ServerNotification::CancelledNotification(request) => request.method(),
5969+
ServerNotification::ProgressNotification(request) => request.method(),
5970+
ServerNotification::ResourceListChangedNotification(request) => request.method(),
5971+
ServerNotification::ResourceUpdatedNotification(request) => request.method(),
5972+
ServerNotification::PromptListChangedNotification(request) => request.method(),
5973+
ServerNotification::ToolListChangedNotification(request) => request.method(),
5974+
ServerNotification::LoggingMessageNotification(request) => request.method(),
5975+
}
5976+
}
59315977
}

0 commit comments

Comments
 (0)