Skip to content
Closed
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
9 changes: 9 additions & 0 deletions crates/rmcp/src/handler/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ impl<H: ClientHandler> Service<RoleClient> for H {
notification: <RoleClient as ServiceRole>::PeerNot,
) -> Result<(), McpError> {
match notification {
ServerNotification::StderrNotification(notification) => {
self.on_stderr(notification.params).await
}
ServerNotification::CancelledNotification(notification) => {
self.on_cancelled(notification.params).await
}
Expand Down Expand Up @@ -98,6 +101,12 @@ pub trait ClientHandler: Sized + Send + Sync + 'static {
) -> impl Future<Output = ()> + Send + '_ {
std::future::ready(())
}
fn on_stderr(
&self,
params: StderrNotificationParam,
) -> impl Future<Output = ()> + Send + '_ {
std::future::ready(())
}
fn on_progress(
&self,
params: ProgressNotificationParam,
Expand Down
9 changes: 9 additions & 0 deletions crates/rmcp/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,14 @@ pub struct PaginatedRequestParam {
const_string!(PingRequestMethod = "ping");
pub type PingRequest = RequestNoParam<PingRequestMethod>;

const_string!(StderrNotificationMethod = "notifications/stderr");
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct StderrNotificationParam {
pub content: String,
}
pub type StderrNotification = Notification<StderrNotificationMethod, StderrNotificationParam>;

const_string!(ProgressNotificationMethod = "notifications/progress");
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "camelCase")]
Expand Down Expand Up @@ -1082,6 +1090,7 @@ ts_union!(
| ResourceUpdatedNotification
| ResourceListChangedNotification
| ToolListChangedNotification
| StderrNotification
| PromptListChangedNotification;
);

Expand Down
1 change: 1 addition & 0 deletions crates/rmcp/src/model/meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ variant_extension! {
ResourceListChangedNotification
ToolListChangedNotification
PromptListChangedNotification
StderrNotification
}
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
Expand Down
Loading