Completions follow-ups

未关闭
#1,318 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@weiwastron 已经在做这个了。

开始于 2026年11月16日。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
55/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
java

调研方向

Read the follow-up items alongside the #1316 review, then trace CompletionsFeature.handle, CompleteReference, McpFeature.completionRefTypes(), and ResourcesFeature.complete. Check the completion tests for missing-type refs, custom ref types, and concrete resource URIs; compare the resource behavior with the legacy McpAsyncServer. Confirm the intended concrete-resource behavior before treating that item as done.

由索引模型根据 Issue 内容生成。

描述

waiting for user

Follow-ups from the review of #1316. Each item can go in its own small PR.

  1. 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.

  2. 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.

  3. 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

主要语言
Java
星标
3.8k
派生
1.1k
平均合并
1 天 3 小时
30 天内合并 PR
38

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

modelcontextprotocol/java-sdk 的其他 Issue

查看 modelcontextprotocol/java-sdk 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。