Describe the bug
Client.assertCapabilityForMethod gates completion/complete (CompletionComplete) on the server's prompts capability instead of completions. A server that declares completions but not prompts therefore cannot be used for completion.
Affected version: 0.13.0 / main.
To Reproduce
Steps to reproduce the behavior:
- Connect a
Client (default options) to a server whose initialize response declares completions (and resources) but not prompts.
- Send a completion request:
val request = buildCompleteRequest {
ref(ResourceTemplateReference("db://{table}/{id}"))
argument("table", "user")
}
client.complete(request)
// throws IllegalStateException: "Server does not support prompts (required for CompletionComplete)"
Such a server is a legitimate configuration: completion also serves resource-template URIs (ref/resource), not only prompt arguments.
Expected behavior
completion/complete is gated on the server's completions capability: a server that declares completions (regardless of prompts) can be used for completion, and a server without completions is rejected.
Additional context
In Client.kt, CompletionComplete is grouped with PromptsGet / PromptsList and checked against serverCapabilities?.prompts, while completions is a separate capability in ServerCapabilities. The TypeScript SDK gates this method on completions in its own case.
A minimal fix gates completion/complete on completions, with a regression test. PR to follow.
Describe the bug
Client.assertCapabilityForMethodgatescompletion/complete(CompletionComplete) on the server'spromptscapability instead ofcompletions. A server that declarescompletionsbut notpromptstherefore cannot be used for completion.Affected version:
0.13.0/main.To Reproduce
Steps to reproduce the behavior:
Client(default options) to a server whoseinitializeresponse declarescompletions(andresources) but notprompts.Such a server is a legitimate configuration: completion also serves resource-template URIs (
ref/resource), not only prompt arguments.Expected behavior
completion/completeis gated on the server'scompletionscapability: a server that declarescompletions(regardless ofprompts) can be used for completion, and a server withoutcompletionsis rejected.Additional context
In
Client.kt,CompletionCompleteis grouped withPromptsGet/PromptsListand checked againstserverCapabilities?.prompts, whilecompletionsis a separate capability inServerCapabilities. The TypeScript SDK gates this method oncompletionsin its own case.A minimal fix gates
completion/completeoncompletions, with a regression test. PR to follow.