Skip to content

[Server] Fix completion/complete crash for plain ref/resource#388

Merged
chr-hertel merged 1 commit into
modelcontextprotocol:mainfrom
NarimanGardi:fix/completion-complete-plain-resource
Jul 5, 2026
Merged

[Server] Fix completion/complete crash for plain ref/resource#388
chr-hertel merged 1 commit into
modelcontextprotocol:mainfrom
NarimanGardi:fix/completion-complete-plain-resource

Conversation

@NarimanGardi

Copy link
Copy Markdown
Contributor

Fixes #387.

completion/complete crashes for a ref/resource pointing at a plain resource: getResource() returns a ResourceReference, but the handler reads $reference->completionProviders, which only PromptReference and ResourceTemplateReference declare.

Providers now come from the prompt or the matched resource template; a resource with no template yields an empty completion result. Added a handler test for both the plain-resource regression and the resource-template path.

A non-template resource resolves to a ResourceReference, which has no completionProviders property; only prompts and resource templates do. Read providers from those instead, returning an empty completion result when a resource has none.
@chr-hertel chr-hertel added bug Something isn't working Server Issues & PRs related to the Server component P2 Moderate issues affecting some users, edge cases, potentially valuable feature labels Jul 5, 2026

@chr-hertel chr-hertel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix @NarimanGardi!

@chr-hertel chr-hertel merged commit 00a568e into modelcontextprotocol:main Jul 5, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working P2 Moderate issues affecting some users, edge cases, potentially valuable feature Server Issues & PRs related to the Server component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Server] completion/complete crashes for plain ref/resource

2 participants