Skip to content

Conversation

FlySky-z
Copy link

@FlySky-z FlySky-z commented Aug 13, 2025

Complete Issue #19

This pull request adds support for parameter auto-completion for prompts and resources to the MCP client/server framework. It introduces new completion handlers and updates both the server and client example applications to demonstrate and utilize these features. The changes are grouped into API extensions, server-side handler implementations, and client-side demonstration updates.

API Extensions

  • Added a new CompleteCompletion method to the Connector interface and implemented it in the client, enabling parameter auto-completion for prompts and resource URIs.
  • Updated server capability reporting to indicate support for completions when appropriate handlers are registered.

Server-side Handler Implementations

  • When registering prompt and resource, add the option parameter to inject parameters such as CompletionCompleteHandler

  • Registered new completion handlers for resources and prompts, including resource completion, resource template completion, and prompt argument completion (e.g., language suggestions for code review).

  • Updated the handler dispatch logic to route completion requests based on reference type (prompt or resource).

  • Added errors.ErrMethodNotFound for indicating that a method has not been registered.

  • Added handling of panic situations in handleReadResource in manager_resource when the handler is nil during registration.

Client-side Demonstration Updates

  • Enhanced the client example to demonstrate completion functionality for prompts, resources and resources template, including logging completion suggestions for various cases.
  • Added logging of server capabilities during client initialization for better visibility of supported features.

These changes provide a foundation for interactive auto-completion in the MCP framework, improving usability for both prompt and resource operations.

image

@FlySky-z FlySky-z changed the title feat: Support completion handling for prompts and resources feat: Implement completion handling for prompts and resources Aug 13, 2025
- Added completionCompleteHandler to registeredPrompt and registeredResource for handling completion requests.
- Refactored handleCompletionComplete methods in promptManager and resourceManager to utilize new completion handlers.
- Added utility functions for extracting parameters from JSON-RPC requests.
- Updated lifecycleManager to check for completion availability in both prompt and resource managers.
- Implemented tests for completion handling in both promptManager and resourceManager, ensuring correct behavior for valid and invalid requests.
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.

1 participant