Skip to content

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

Open
NarimanGardi wants to merge 1 commit into
modelcontextprotocol:mainfrom
NarimanGardi:fix/completion-complete-plain-resource
Open

[Server] Fix completion/complete crash for plain ref/resource#388
NarimanGardi wants to merge 1 commit into
modelcontextprotocol:mainfrom
NarimanGardi:fix/completion-complete-plain-resource

Conversation

@NarimanGardi

Copy link
Copy Markdown

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant