Update PING request handler, return empty map instead of empty string
Co-authored-by: NAME <NAME@EXAMPLE.COM> Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
This commit is contained in:
parent
64f424d91b
commit
5bd950d668
1 changed files with 3 additions and 2 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue