File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
api/src/main/java/io/kafbat/ui/service/mcp Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -93,7 +93,12 @@ 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- return Mono .just (this .callToolResult (response .getBody ()));
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 ));
97102 } else {
98103 try {
99104 return Mono .just (toErrorResult (objectMapper .writeValueAsString (response .getBody ())));
You can’t perform that action at this time.
0 commit comments