Skip to content

Commit 08ee527

Browse files
committed
Refactor Flux response body handling in McpSpecificationGenerator
1 parent 054e524 commit 08ee527

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

api/src/main/java/io/kafbat/ui/service/mcp/McpSpecificationGenerator.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,7 @@ private Mono<CallToolResult> toCallResult(Object result) {
9393
private Mono<CallToolResult> reponseToCallResult(ResponseEntity<?> response) {
9494
HttpStatusCode statusCode = response.getStatusCode();
9595
if (statusCode.is2xxSuccessful() || statusCode.is1xxInformational()) {
96-
Object body = response.getBody();
97-
// Handle Flux response bodies by collecting them into a list
98-
if (body instanceof Flux<?> flux) {
99-
return flux.collectList().map(this::callToolResult);
100-
}
101-
return Mono.just(this.callToolResult(body));
96+
return toCallResult(response.getBody());
10297
} else {
10398
try {
10499
return Mono.just(toErrorResult(objectMapper.writeValueAsString(response.getBody())));

0 commit comments

Comments
 (0)