Skip to content

Commit 18e10f0

Browse files
committed
address review
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
1 parent 521c2cc commit 18e10f0

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

mcp-spring/mcp-spring-webflux/src/main/java/io/modelcontextprotocol/client/transport/WebClientStreamableHttpTransport.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ else if (mediaType.isCompatibleWith(MediaType.APPLICATION_JSON)) {
288288
logger.trace("Received response to POST for session {}", sessionRepresentation);
289289
// communicate to caller the message was delivered
290290
sink.success();
291-
return statelessResponseFlux(message, response);
291+
return directResponseFlux(message, response);
292292
}
293293
else {
294294
logger.warn("Unknown media type {} returned for POST in session {}", contentType,
@@ -385,12 +385,12 @@ private static String sessionIdOrPlaceholder(McpTransportSession<?> transportSes
385385
return transportSession.sessionId().orElse("[missing_session_id]");
386386
}
387387

388-
private Flux<McpSchema.JSONRPCMessage> statelessResponseFlux(McpSchema.JSONRPCMessage sendMessage,
388+
private Flux<McpSchema.JSONRPCMessage> directResponseFlux(McpSchema.JSONRPCMessage sentMessage,
389389
ClientResponse response) {
390390
return response.bodyToMono(String.class).<Iterable<McpSchema.JSONRPCMessage>>handle((responseMessage, s) -> {
391391
try {
392-
if (sendMessage instanceof McpSchema.JSONRPCNotification && Utils.hasText(responseMessage)) {
393-
logger.warn("Notificaiton: {} received non-compliant response: {}", sendMessage, responseMessage);
392+
if (sentMessage instanceof McpSchema.JSONRPCNotification && Utils.hasText(responseMessage)) {
393+
logger.warn("Notificaiton: {} received non-compliant response: {}", sentMessage, responseMessage);
394394
}
395395
else {
396396
McpSchema.JSONRPCMessage jsonRpcResponse = McpSchema.deserializeJsonRpcMessage(objectMapper,

mcp/src/main/java/io/modelcontextprotocol/client/transport/HttpClientStreamableHttpTransport.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -342,9 +342,9 @@ public String toString(McpSchema.JSONRPCMessage message) {
342342
}
343343
}
344344

345-
public Mono<Void> sendMessage(McpSchema.JSONRPCMessage sendMessage) {
345+
public Mono<Void> sendMessage(McpSchema.JSONRPCMessage sentMessage) {
346346
return Mono.create(messageSink -> {
347-
logger.debug("Sending message {}", sendMessage);
347+
logger.debug("Sending message {}", sentMessage);
348348

349349
final AtomicReference<Disposable> disposableRef = new AtomicReference<>();
350350
final McpTransportSession<Disposable> transportSession = this.activeSession.get();
@@ -355,7 +355,7 @@ public Mono<Void> sendMessage(McpSchema.JSONRPCMessage sendMessage) {
355355
requestBuilder = requestBuilder.header("mcp-session-id", transportSession.sessionId().get());
356356
}
357357

358-
String jsonBody = this.toString(sendMessage);
358+
String jsonBody = this.toString(sentMessage);
359359

360360
HttpRequest request = requestBuilder.uri(Utils.resolveUri(this.baseUri, this.endpoint))
361361
.header("Accept", APPLICATION_JSON + ", " + TEXT_EVENT_STREAM)
@@ -436,8 +436,8 @@ else if (contentType.contains(TEXT_EVENT_STREAM)) {
436436
else if (contentType.contains(APPLICATION_JSON)) {
437437
messageSink.success();
438438
String data = ((ResponseSubscribers.AggregateResponseEvent) responseEvent).data();
439-
if (sendMessage instanceof McpSchema.JSONRPCNotification && Utils.hasText(data)) {
440-
logger.warn("Notificaiton: {} received non-compliant response: {}", sendMessage, data);
439+
if (sentMessage instanceof McpSchema.JSONRPCNotification && Utils.hasText(data)) {
440+
logger.warn("Notificaiton: {} received non-compliant response: {}", sentMessage, data);
441441
return Mono.empty();
442442
}
443443

0 commit comments

Comments
 (0)