diff --git a/mcp/src/main/java/io/modelcontextprotocol/server/McpAsyncServer.java b/mcp/src/main/java/io/modelcontextprotocol/server/McpAsyncServer.java index 07a9f15..ef69539 100644 --- a/mcp/src/main/java/io/modelcontextprotocol/server/McpAsyncServer.java +++ b/mcp/src/main/java/io/modelcontextprotocol/server/McpAsyncServer.java @@ -6,6 +6,7 @@ package io.modelcontextprotocol.server; import java.time.Duration; import java.util.HashMap; +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Optional; @@ -403,7 +404,7 @@ public class McpAsyncServer { // Initialize request handlers for standard MCP methods // Ping MUST respond with an empty data, but not NULL response. - requestHandlers.put(McpSchema.METHOD_PING, (exchange, params) -> Mono.just("")); + requestHandlers.put(McpSchema.METHOD_PING, (exchange, params) -> Mono.just(Map.of())); // Add tools API handlers if the tool capability is enabled if (this.serverCapabilities.tools() != null) { @@ -926,7 +927,7 @@ public class McpAsyncServer { requestHandlers.put(McpSchema.METHOD_INITIALIZE, asyncInitializeRequestHandler()); // Ping MUST respond with an empty data, but not NULL response. - requestHandlers.put(McpSchema.METHOD_PING, (params) -> Mono.just("")); + requestHandlers.put(McpSchema.METHOD_PING, (params) -> Mono.just(Map.of())); // Add tools API handlers if the tool capability is enabled if (this.serverCapabilities.tools() != null) {