Skip to content

Commit 39400b6

Browse files
authored
feat: add utility function for easy detection of initialized notifications (#38)
* add is_initialized_notification utility function * Update schema_utils.rs * Update schema_utils.rs * Update schema_utils.rs
1 parent 034ee8f commit 39400b6

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

src/generated_schema/2024_11_05/mcp_schema.rs

Lines changed: 2 additions & 2 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.6.
2+
/// This file is auto-generated by mcp-schema-gen v0.1.7.
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>
88
/// Hash : bb1446ff1810a0df57989d78366d626d2c01b9d7
9-
/// Generated at : 2025-02-22 12:34:28
9+
/// Generated at : 2025-02-22 14:26:53
1010
/// ----------------------------------------------------------------------------
1111
///
1212
/// MCP Protocol Version

src/generated_schema/2024_11_05/schema_utils.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,14 @@ impl TryFrom<NotificationFromClient> for ClientNotification {
493493
}
494494

495495
impl NotificationFromClient {
496+
/// Checks if the current notification is an `InitializedNotification` from the client, indicating that the client has been initialized.
497+
pub fn is_initialized_notification(&self) -> bool {
498+
matches!(
499+
self,
500+
NotificationFromClient::ClientNotification(ClientNotification::InitializedNotification(_))
501+
)
502+
}
503+
496504
#[deprecated(since = "0.1.4", note = "Use `method()` instead.")]
497505
pub fn get_method(&self) -> &str {
498506
match self {

src/generated_schema/draft/mcp_schema.rs

Lines changed: 2 additions & 2 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.6.
2+
/// This file is auto-generated by mcp-schema-gen v0.1.7.
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>
88
/// Hash : bb1446ff1810a0df57989d78366d626d2c01b9d7
9-
/// Generated at : 2025-02-22 12:34:29
9+
/// Generated at : 2025-02-22 14:26:53
1010
/// ----------------------------------------------------------------------------
1111
///
1212
/// MCP Protocol Version

src/generated_schema/draft/schema_utils.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,14 @@ impl TryFrom<NotificationFromClient> for ClientNotification {
493493
}
494494

495495
impl NotificationFromClient {
496+
/// Checks if the current notification is an `InitializedNotification` from the client, indicating that the client has been initialized.
497+
pub fn is_initialized_notification(&self) -> bool {
498+
matches!(
499+
self,
500+
NotificationFromClient::ClientNotification(ClientNotification::InitializedNotification(_))
501+
)
502+
}
503+
496504
#[deprecated(since = "0.1.4", note = "Use `method()` instead.")]
497505
pub fn get_method(&self) -> &str {
498506
match self {

0 commit comments

Comments
 (0)