Skip to content

fix: Ensure completions capability is registered on setCompletionRequestHandler call #546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

fredericbarthelet
Copy link
Contributor

@fredericbarthelet fredericbarthelet commented May 26, 2025

Advertising support for completions in servers where a completionRequestHandler has been defined - meaning, when at least one resource or one prompt has been registered.

Just like:

  • registerCapabilities is called to add tools support on setToolRequestHandlers call
  • registerCapabilities is called to add resources support on setResourceRequestHandlers call
  • registerCapabilities is called to add prompts support on setPromptRequestHandlers call

this PR calls registerCapabilities to turn completions support on whenever setCompletionRequestHandler is called

Motivation and Context

While implementing modelcontextprotocol/inspector#441, I found out that the only way to advertise completions support was defining it manually in Server constructor argument.

How Has This Been Tested?

I've tested this both with an application with a ResourceTemplate and a prompt with completable argument.

Breaking Changes

None

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

@fredericbarthelet fredericbarthelet changed the title fix: Ensure completions capabilities is registered on setCompletionRequestHandler call fix: Ensure completions capability is registered on setCompletionRequestHandler call May 26, 2025
@ihrpr ihrpr added this to 🐛 🛠 May 29, 2025
@github-project-automation github-project-automation bot moved this to To triage in 🐛 🛠 May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To triage
Development

Successfully merging this pull request may close these issues.

1 participant