You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-ups from the review of #1316. Each item can go in its own small PR.
A ref without type returns an internal error instead of invalid params.CompletionsFeature.handle looks up byRefType.get(ref.get("type")). byRefType comes from Map.copyOf, and get(null) on an immutable map throws an NPE, so a request like {"ref": {"name": "x"}, ...} gets -32603 instead of -32602.
McpFeature.completionRefTypes() can't serve a new reference type.CompletionsFeature decodes every request into CompleteRequest before calling feature.complete(...). CompleteReference only lists ref/prompt and ref/resource in @JsonSubTypes, so a feature that declares ref/custom is advertised and routed to, but decoding fails with -32602 "Malformed CompleteRequest" before complete() runs. Today a custom feature can only take over one of the two built-in types. Either remove the extension point until there's a use case, or let complete() take the raw params, as handle() does.
ref/resource with a concrete resource URI is rejected.ResourcesFeature.complete only resolves ref/resource through an exact findTemplate match, so a reference to an existing resource such as test://static-text gets -32602 "Unknown resource template". The legacy McpAsyncServer returns an empty completion here, so the two server stacks now differ. Confirm if this is intentional
Hi @tzolov, I’d like to take item 1 of this issue. I’ll add a regression test for a completion request missing ref.type, then guard the lookup so it returns -32602 instead of -32603. I’ll keep the PR limited to item 1.
I propose changing complete() to accept Object params, allowing custom features to handle their own parameter deserialization, while keeping common request validation in CompletionsFeature.
To maintain backward compatibility, we could retain the existing complete(McpRequestContext, CompleteRequest) method and introduce the new complete(McpRequestContext, Object) method with a default implementation that delegates to the existing one. This would allow existing feature implementations to continue working while enabling custom reference types.
Would this approach be acceptable? Also, do we need to consider any additional migration guidance for existing implementations?
Activity
media-ctrl commentedon Nov 9, 2026
neerajbhatt commentedon Nov 14, 2026
Hi @tzolov, I’d like to take item 1 of this issue. I’ll add a regression test for a completion request missing ref.type, then guard the lookup so it returns -32602 instead of -32603. I’ll keep the PR limited to item 1.
weiwastron commentedon Nov 16, 2026
Hi, @tzolov, I'd like to work on item 2.
I propose changing
complete()to acceptObject params, allowing custom features to handle their own parameter deserialization, while keeping common request validation inCompletionsFeature.To maintain backward compatibility, we could retain the existing
complete(McpRequestContext, CompleteRequest)method and introduce the newcomplete(McpRequestContext, Object)method with a default implementation that delegates to the existing one. This would allow existing feature implementations to continue working while enabling custom reference types.Would this approach be acceptable? Also, do we need to consider any additional migration guidance for existing implementations?