feat: implement ping request handler in MCP async client (#203)
- Add ping request handler that responds with empty Map instead of null - Ensure compliance with MCP protocol requirement for ping responses - Add test for ping message request handling Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
This commit is contained in:
parent
1cbace3353
commit
ebb9764c1b
1 changed files with 30 additions and 1 deletions
|
|
@ -187,6 +187,9 @@ public class McpAsyncClient {
|
|||
// Request Handlers
|
||||
Map<String, RequestHandler<?>> requestHandlers = new HashMap<>();
|
||||
|
||||
// Ping MUST respond with an empty data, but not NULL response.
|
||||
requestHandlers.put(McpSchema.METHOD_PING, params -> Mono.just(Map.of()));
|
||||
|
||||
// Roots List Request Handler
|
||||
if (this.clientCapabilities.roots() != null) {
|
||||
requestHandlers.put(McpSchema.METHOD_ROOTS_LIST, rootsListRequestHandler());
|
||||
|
|
|
|||
Loading…
Reference in a new issue