pub struct NotificationBuilder { /* private fields */ }Expand description
Builder for creating notifications at runtime
Implementations§
Source§impl NotificationBuilder
impl NotificationBuilder
Sourcepub fn new(method: impl Into<String>) -> Self
pub fn new(method: impl Into<String>) -> Self
Create a new notification builder with the given method
Sourcepub fn params(self, params: NotificationParams) -> Self
pub fn params(self, params: NotificationParams) -> Self
Set notification parameters
Sourcepub fn param(self, key: impl Into<String>, value: Value) -> Self
pub fn param(self, key: impl Into<String>, value: Value) -> Self
Add a parameter to the notification
Sourcepub fn meta_value(self, key: impl Into<String>, value: Value) -> Self
pub fn meta_value(self, key: impl Into<String>, value: Value) -> Self
Add a meta key-value pair
Sourcepub fn priority(self, priority: u32) -> Self
pub fn priority(self, priority: u32) -> Self
Set notification priority (higher = more important)
Sourcepub fn can_batch(self, can_batch: bool) -> Self
pub fn can_batch(self, can_batch: bool) -> Self
Set whether this notification can be batched with others
Sourcepub fn max_retries(self, max_retries: u32) -> Self
pub fn max_retries(self, max_retries: u32) -> Self
Set maximum retry attempts
Sourcepub fn build(self) -> Notification
pub fn build(self) -> Notification
Build the notification
Sourcepub fn build_dynamic(self) -> DynamicNotification
pub fn build_dynamic(self) -> DynamicNotification
Build a dynamic notification that implements the definition traits
Source§impl NotificationBuilder
Convenience methods for common notification patterns
impl NotificationBuilder
Convenience methods for common notification patterns
Sourcepub fn resource_list_changed() -> ResourceListChangedNotification
pub fn resource_list_changed() -> ResourceListChangedNotification
Create a resource list changed notification
Sourcepub fn tool_list_changed() -> ToolListChangedNotification
pub fn tool_list_changed() -> ToolListChangedNotification
Create a tool list changed notification
Sourcepub fn prompt_list_changed() -> PromptListChangedNotification
pub fn prompt_list_changed() -> PromptListChangedNotification
Create a prompt list changed notification
Sourcepub fn roots_list_changed() -> RootsListChangedNotification
pub fn roots_list_changed() -> RootsListChangedNotification
Create a roots list changed notification
Sourcepub fn initialized() -> InitializedNotification
pub fn initialized() -> InitializedNotification
Create an initialized notification
Sourcepub fn progress(
progress_token: impl Into<String>,
progress: u64,
) -> ProgressNotificationBuilder
pub fn progress( progress_token: impl Into<String>, progress: u64, ) -> ProgressNotificationBuilder
Create a progress notification builder
Sourcepub fn resource_updated(
uri: impl Into<String>,
) -> ResourceUpdatedNotificationBuilder
pub fn resource_updated( uri: impl Into<String>, ) -> ResourceUpdatedNotificationBuilder
Create a resource updated notification builder
Sourcepub fn cancelled(request_id: RequestId) -> CancelledNotificationBuilder
pub fn cancelled(request_id: RequestId) -> CancelledNotificationBuilder
Create a cancelled notification builder
Sourcepub fn logging_message(
level: LoggingLevel,
data: Value,
) -> LoggingMessageNotification
pub fn logging_message( level: LoggingLevel, data: Value, ) -> LoggingMessageNotification
Create a logging message notification builder
Sourcepub fn server_notification(method: impl Into<String>) -> Self
pub fn server_notification(method: impl Into<String>) -> Self
Create a server-to-client notification