Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@ private Mono<CallToolResult> toCallResult(Object result) {
private Mono<CallToolResult> reponseToCallResult(ResponseEntity<?> response) {
HttpStatusCode statusCode = response.getStatusCode();
if (statusCode.is2xxSuccessful() || statusCode.is1xxInformational()) {
return Mono.just(this.callToolResult(response.getBody()));
Object body = response.getBody();
// Handle Flux response bodies by collecting them into a list
if (body instanceof Flux<?> flux) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to see this trick in the callToolResult method

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the quick review, good point, updated

return flux.collectList().map(this::callToolResult);
}
return Mono.just(this.callToolResult(body));
} else {
try {
return Mono.just(toErrorResult(objectMapper.writeValueAsString(response.getBody())));
Expand Down
Loading