Skip to content

feat: add utility function for easy detection of initialized notifications #38

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 5 commits into from
Feb 23, 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
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
@@ -1,12 +1,12 @@
/// ----------------------------------------------------------------------------
/// This file is auto-generated by mcp-schema-gen v0.1.6.
/// This file is auto-generated by mcp-schema-gen v0.1.7.
/// WARNING:
/// It is not recommended to modify this file directly. You are free to
/// modify or extend the implementations as needed, but please do so at your own risk.
///
/// Generated from : <https://github.com/modelcontextprotocol/specification.git>
/// Hash : bb1446ff1810a0df57989d78366d626d2c01b9d7
/// Generated at : 2025-02-22 12:34:28
/// Generated at : 2025-02-22 14:26:53
/// ----------------------------------------------------------------------------
///
/// MCP Protocol Version
Expand Down
8 changes: 8 additions & 0 deletions src/generated_schema/2024_11_05/schema_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,14 @@ impl TryFrom<NotificationFromClient> for ClientNotification {
}

impl NotificationFromClient {
/// Checks if the current notification is an `InitializedNotification` from the client, indicating that the client has been initialized.
pub fn is_initialized_notification(&self) -> bool {
matches!(
self,
NotificationFromClient::ClientNotification(ClientNotification::InitializedNotification(_))
)
}

#[deprecated(since = "0.1.4", note = "Use `method()` instead.")]
pub fn get_method(&self) -> &str {
match self {
Expand Down
4 changes: 2 additions & 2 deletions src/generated_schema/draft/mcp_schema.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/// ----------------------------------------------------------------------------
/// This file is auto-generated by mcp-schema-gen v0.1.6.
/// This file is auto-generated by mcp-schema-gen v0.1.7.
/// WARNING:
/// It is not recommended to modify this file directly. You are free to
/// modify or extend the implementations as needed, but please do so at your own risk.
///
/// Generated from : <https://github.com/modelcontextprotocol/specification.git>
/// Hash : bb1446ff1810a0df57989d78366d626d2c01b9d7
/// Generated at : 2025-02-22 12:34:29
/// Generated at : 2025-02-22 14:26:53
/// ----------------------------------------------------------------------------
///
/// MCP Protocol Version
Expand Down
8 changes: 8 additions & 0 deletions src/generated_schema/draft/schema_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,14 @@ impl TryFrom<NotificationFromClient> for ClientNotification {
}

impl NotificationFromClient {
/// Checks if the current notification is an `InitializedNotification` from the client, indicating that the client has been initialized.
pub fn is_initialized_notification(&self) -> bool {
matches!(
self,
NotificationFromClient::ClientNotification(ClientNotification::InitializedNotification(_))
)
}

#[deprecated(since = "0.1.4", note = "Use `method()` instead.")]
pub fn get_method(&self) -> &str {
match self {
Expand Down