fix: Handle non-compliant notification responses (#589)
Ensure warnings are logged for all non-compliant responses to JSON-RPC notifications, including empty responses. Empty responses now display as "[empty]" in log messages for better clarity. Resolves #586 Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
This commit is contained in:
parent
080098e48c
commit
3f7578b3ce
1 changed files with 6 additions and 4 deletions
|
|
@ -507,8 +507,9 @@ public class HttpClientStreamableHttpTransport implements McpClientTransport {
|
|||
else if (contentType.contains(APPLICATION_JSON)) {
|
||||
deliveredSink.success();
|
||||
String data = ((ResponseSubscribers.AggregateResponseEvent) responseEvent).data();
|
||||
if (sentMessage instanceof McpSchema.JSONRPCNotification && Utils.hasText(data)) {
|
||||
logger.warn("Notification: {} received non-compliant response: {}", sentMessage, data);
|
||||
if (sentMessage instanceof McpSchema.JSONRPCNotification) {
|
||||
logger.warn("Notification: {} received non-compliant response: {}", sentMessage,
|
||||
Utils.hasText(data) ? data : "[empty]");
|
||||
return Mono.empty();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue