Skip to content

Commit ab4ccdb

Browse files
committed
refactor(rmcp): improve logging for response errors and adjust tracing levels
1 parent b9a40b1 commit ab4ccdb

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

crates/rmcp/src/service.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ use crate::model::ServerJsonRpcMessage;
4747
use crate::{
4848
error::ErrorData as McpError,
4949
model::{
50-
CancelledNotification, CancelledNotificationParam, Extensions, GetExtensions, GetMeta,
51-
JsonRpcError, JsonRpcMessage, JsonRpcNotification, JsonRpcRequest, JsonRpcResponse, Meta,
52-
NumberOrString, ProgressToken, RequestId,
50+
CancelledNotification, CancelledNotificationParam, ErrorCode, Extensions, GetExtensions,
51+
GetMeta, JsonRpcError, JsonRpcMessage, JsonRpcNotification, JsonRpcRequest,
52+
JsonRpcResponse, Meta, NumberOrString, ProgressToken, RequestId,
5353
},
5454
transport::{DynamicTransportError, IntoTransport, Transport},
5555
};
@@ -970,7 +970,13 @@ where
970970
JsonRpcMessage::response(result, id)
971971
}
972972
Err(error) => {
973-
tracing::warn!(%id, ?error, "response error");
973+
// Method-not-found is expected client probing
974+
// (e.g. unsupported `resources/subscribe`); demote to debug.
975+
if error.code == ErrorCode::METHOD_NOT_FOUND {
976+
tracing::debug!(%id, ?error, "response error");
977+
} else {
978+
tracing::warn!(%id, ?error, "response error");
979+
}
974980
JsonRpcMessage::error(error, id)
975981
}
976982
};

crates/rmcp/src/transport/streamable_http_server/tower.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ where
891891
// with the same Last-Event-ID in an infinite loop. An empty
892892
// 200 cleanly terminates the EventSource without delivering
893893
// events from a different stream.
894-
tracing::warn!("Resume failed ({e}), returning empty stream");
894+
tracing::debug!("Resume failed ({e}), returning empty stream");
895895
return Ok(sse_stream_response(
896896
futures::stream::empty(),
897897
None,

0 commit comments

Comments
 (0)