Skip to content

Commit 110a8d1

Browse files
committed
refactor: downgrade unhandled notification logging from error to warn
- Change logger.error() to logger.warn() for unhandled notification methods - Log full notification object instead of just method name for better context - Affects McpClientSession, McpServerSession, and McpStreamableServerSession Signed-off-by: Christian Tzolov <[email protected]>
1 parent 7f37ddc commit 110a8d1

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

mcp/src/main/java/io/modelcontextprotocol/spec/McpClientSession.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ private Mono<Void> handleIncomingNotification(McpSchema.JSONRPCNotification noti
221221
return Mono.defer(() -> {
222222
var handler = notificationHandlers.get(notification.method());
223223
if (handler == null) {
224-
logger.error("No handler registered for notification method: {}", notification.method());
224+
logger.warn("No handler registered for notification method: {}", notification);
225225
return Mono.empty();
226226
}
227227
return handler.handle(notification.params());

mcp/src/main/java/io/modelcontextprotocol/spec/McpServerSession.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ private Mono<Void> handleIncomingNotification(McpSchema.JSONRPCNotification noti
294294

295295
var handler = notificationHandlers.get(notification.method());
296296
if (handler == null) {
297-
logger.error("No handler registered for notification method: {}", notification.method());
297+
logger.warn("No handler registered for notification method: {}", notification);
298298
return Mono.empty();
299299
}
300300
return this.exchangeSink.asMono().flatMap(exchange -> handler.handle(exchange, notification.params()));

mcp/src/main/java/io/modelcontextprotocol/spec/McpStreamableServerSession.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public Mono<Void> accept(McpSchema.JSONRPCNotification notification) {
197197
McpTransportContext transportContext = ctx.getOrDefault(McpTransportContext.KEY, McpTransportContext.EMPTY);
198198
McpNotificationHandler notificationHandler = this.notificationHandlers.get(notification.method());
199199
if (notificationHandler == null) {
200-
logger.error("No handler registered for notification method: {}", notification.method());
200+
logger.warn("No handler registered for notification method: {}", notification);
201201
return Mono.empty();
202202
}
203203
McpLoggableSession listeningStream = this.listeningStreamRef.get();

0 commit comments

Comments
 (0)