Skip to content

Commit 1db3b10

Browse files
committed
Check the if id is null or not before starting the SSE channel
1 parent e8e5dc8 commit 1db3b10

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mcp/runtime/src/main/java/io/quarkiverse/langchain4j/mcp/runtime/http/QuarkusStreamableHttpMcpTransport.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,9 @@ private Uni<JsonNode> execute(McpClientMessage request, Long id) {
142142
log.debug("Assigned MCP session ID: " + mcpSessionId);
143143
this.mcpSessionId.set(mcpSessionId);
144144
}
145+
145146
String contentType = response.result().getHeader("Content-Type");
146-
if (contentType != null && contentType.contains("text/event-stream")) {
147+
if (id != null && contentType != null && contentType.contains("text/event-stream")) {
147148
// the server has started a SSE channel
148149
response.result().handler(bodyBuffer -> {
149150
String responseString = bodyBuffer.toString();

0 commit comments

Comments
 (0)