fix: Return empty prompt completion result when prompt has no arguments (#934)
Recent changes don't coerce null completion arguments to empty lists so we have to check for null when handling prompt completions. Resolves #932 Signed-off-by: Dariusz Jędrzejczyk <2554306+chemicL@users.noreply.github.com>
This commit is contained in:
parent
4c8596306d
commit
5895b2edd2
2 changed files with 45 additions and 19 deletions
|
|
@ -999,12 +999,9 @@ public class McpAsyncServer {
|
|||
.message("Prompt not found: " + promptReference.name())
|
||||
.build());
|
||||
}
|
||||
if (!promptSpec.prompt()
|
||||
.arguments()
|
||||
.stream()
|
||||
.filter(arg -> arg.name().equals(argumentName))
|
||||
.findFirst()
|
||||
.isPresent()) {
|
||||
List<McpSchema.PromptArgument> arguments = promptSpec.prompt().arguments();
|
||||
if (arguments == null
|
||||
|| !arguments.stream().filter(arg -> arg.name().equals(argumentName)).findFirst().isPresent()) {
|
||||
|
||||
logger.warn("Argument not found: {} in prompt: {}", argumentName, promptReference.name());
|
||||
|
||||
|
|
|
|||
|
|
@ -744,12 +744,9 @@ public class McpStatelessAsyncServer {
|
|||
.message("Prompt not found: " + promptReference.name())
|
||||
.build());
|
||||
}
|
||||
if (!promptSpec.prompt()
|
||||
.arguments()
|
||||
.stream()
|
||||
.filter(arg -> arg.name().equals(argumentName))
|
||||
.findFirst()
|
||||
.isPresent()) {
|
||||
List<McpSchema.PromptArgument> arguments = promptSpec.prompt().arguments();
|
||||
if (arguments == null
|
||||
|| !arguments.stream().filter(arg -> arg.name().equals(argumentName)).findFirst().isPresent()) {
|
||||
|
||||
logger.warn("Argument not found: {} in prompt: {}", argumentName, promptReference.name());
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue