Skip to content

fix: method access modifiers #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 2, 2025
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 src/generated_schema/2024_11_05/mcp_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
///
/// Generated from : <https://github.com/modelcontextprotocol/specification.git>
/// Hash : bb1446ff1810a0df57989d78366d626d2c01b9d7
/// Generated at : 2025-02-28 18:09:15
/// Generated at : 2025-03-02 12:29:03
/// ----------------------------------------------------------------------------
///
/// MCP Protocol Version
Expand Down
19 changes: 16 additions & 3 deletions src/generated_schema/2024_11_05/schema_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ impl RequestFromClient {
}
}

fn method(&self) -> &str {
pub fn method(&self) -> &str {
match self {
RequestFromClient::ClientRequest(request) => request.method(),
RequestFromClient::CustomRequest(request) => request["method"].as_str().unwrap(),
Expand Down Expand Up @@ -914,7 +914,7 @@ impl RequestFromServer {
}
}

fn method(&self) -> &str {
pub fn method(&self) -> &str {
match self {
RequestFromServer::ServerRequest(request) => request.method(),
RequestFromServer::CustomRequest(request) => request["method"].as_str().unwrap(),
Expand Down Expand Up @@ -1028,7 +1028,7 @@ impl NotificationFromServer {
}
}

fn method(&self) -> &str {
pub fn method(&self) -> &str {
match self {
NotificationFromServer::ServerNotification(notification) => notification.method(),
NotificationFromServer::CustomNotification(notification) => notification["method"].as_str().unwrap(),
Expand Down Expand Up @@ -1368,6 +1368,10 @@ impl FromMessage<MessageFromClient> for ClientMessage {
}
}

//**************************//
//** UnknownTool Error **//
//**************************//

/// A custom error type `UnknownTool` that wraps a `String`.
/// This can be used as the error type in the result of a `CallToolRequest` when a non-existent or unimplemented tool is called.
#[derive(Debug)]
Expand All @@ -1384,6 +1388,9 @@ impl core::fmt::Display for UnknownTool {
// Implement the `Error` trait for `UnknownTool`, making it a valid error type.
impl std::error::Error for UnknownTool {}

//***************************//
//** CallToolError Error **//
//***************************//
/// A specific error type that can hold any kind of error and is used to
/// encapsulate various error scenarios when a `CallToolRequest` fails.
#[derive(Debug)]
Expand Down Expand Up @@ -1426,6 +1433,9 @@ impl From<CallToolError> for CallToolResult {
}
}

//***************************//
//** CallToolResult Impl **//
//***************************//
impl CallToolResult {
/// Create a `CallToolResult` with an error, containing an error message in the content
pub fn with_error(error: CallToolError) -> Self {
Expand Down Expand Up @@ -1473,6 +1483,9 @@ impl CallToolResult {
}
}

//**************************************//
//** CallToolResultContentItem Impl **//
//**************************************//
impl CallToolResultContentItem {
/// Create a `CallToolResultContentItem` with text content and optional annotations
pub fn text_content(test_content: String, annotations: Option<TextContentAnnotations>) -> Self {
Expand Down
2 changes: 1 addition & 1 deletion src/generated_schema/draft/mcp_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
///
/// Generated from : <https://github.com/modelcontextprotocol/specification.git>
/// Hash : bb1446ff1810a0df57989d78366d626d2c01b9d7
/// Generated at : 2025-02-28 18:09:15
/// Generated at : 2025-03-02 12:29:04
/// ----------------------------------------------------------------------------
///
/// MCP Protocol Version
Expand Down
19 changes: 16 additions & 3 deletions src/generated_schema/draft/schema_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ impl RequestFromClient {
}
}

fn method(&self) -> &str {
pub fn method(&self) -> &str {
match self {
RequestFromClient::ClientRequest(request) => request.method(),
RequestFromClient::CustomRequest(request) => request["method"].as_str().unwrap(),
Expand Down Expand Up @@ -914,7 +914,7 @@ impl RequestFromServer {
}
}

fn method(&self) -> &str {
pub fn method(&self) -> &str {
match self {
RequestFromServer::ServerRequest(request) => request.method(),
RequestFromServer::CustomRequest(request) => request["method"].as_str().unwrap(),
Expand Down Expand Up @@ -1028,7 +1028,7 @@ impl NotificationFromServer {
}
}

fn method(&self) -> &str {
pub fn method(&self) -> &str {
match self {
NotificationFromServer::ServerNotification(notification) => notification.method(),
NotificationFromServer::CustomNotification(notification) => notification["method"].as_str().unwrap(),
Expand Down Expand Up @@ -1368,6 +1368,10 @@ impl FromMessage<MessageFromClient> for ClientMessage {
}
}

//**************************//
//** UnknownTool Error **//
//**************************//

/// A custom error type `UnknownTool` that wraps a `String`.
/// This can be used as the error type in the result of a `CallToolRequest` when a non-existent or unimplemented tool is called.
#[derive(Debug)]
Expand All @@ -1384,6 +1388,9 @@ impl core::fmt::Display for UnknownTool {
// Implement the `Error` trait for `UnknownTool`, making it a valid error type.
impl std::error::Error for UnknownTool {}

//***************************//
//** CallToolError Error **//
//***************************//
/// A specific error type that can hold any kind of error and is used to
/// encapsulate various error scenarios when a `CallToolRequest` fails.
#[derive(Debug)]
Expand Down Expand Up @@ -1426,6 +1433,9 @@ impl From<CallToolError> for CallToolResult {
}
}

//***************************//
//** CallToolResult Impl **//
//***************************//
impl CallToolResult {
/// Create a `CallToolResult` with an error, containing an error message in the content
pub fn with_error(error: CallToolError) -> Self {
Expand Down Expand Up @@ -1473,6 +1483,9 @@ impl CallToolResult {
}
}

//**************************************//
//** CallToolResultContentItem Impl **//
//**************************************//
impl CallToolResultContentItem {
/// Create a `CallToolResultContentItem` with text content and optional annotations
pub fn text_content(test_content: String, annotations: Option<TextContentAnnotations>) -> Self {
Expand Down