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 摘要。