fix(server): return empty completion when handler is absent
This commit is contained in:
parent
492c859eb8
commit
301f8b06c7
2 changed files with 204 additions and 7 deletions
|
|
@ -1090,9 +1090,7 @@ public class McpAsyncServer {
|
|||
McpServerFeatures.AsyncCompletionSpecification specification = this.completions.get(request.ref());
|
||||
|
||||
if (specification == null) {
|
||||
return Mono.error(McpError.builder(ErrorCodes.INVALID_PARAMS)
|
||||
.message("AsyncCompletionSpecification not found: " + request.ref())
|
||||
.build());
|
||||
return EMPTY_COMPLETION_RESULT;
|
||||
}
|
||||
|
||||
return Mono.defer(() -> specification.completionHandler().apply(exchange, request));
|
||||
|
|
|
|||
|
|
@ -815,9 +815,7 @@ public class McpStatelessAsyncServer {
|
|||
McpStatelessServerFeatures.AsyncCompletionSpecification specification = this.completions.get(request.ref());
|
||||
|
||||
if (specification == null) {
|
||||
return Mono.error(McpError.builder(ErrorCodes.INVALID_PARAMS)
|
||||
.message("AsyncCompletionSpecification not found: " + request.ref())
|
||||
.build());
|
||||
return EMPTY_COMPLETION_RESULT;
|
||||
}
|
||||
|
||||
return specification.completionHandler().apply(ctx, request);
|
||||
|
|
|
|||
Loading…
Reference in a new issue