Class McpServerCompletion
This class is responsible for creating and managing completion specifications for the Model
Context Protocol (MCP) server. It processes methods annotated with McpPromptCompletion or
McpResourceCompletion and creates the appropriate completion handlers that can provide
auto-completion suggestions.
The component validates method signatures, creates completion references, and handles the invocation of completion methods. It supports both prompt-based and resource-based completion functionality.
- Author:
- codeboyzhou
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
McpServerCompletion
public McpServerCompletion()
-
-
Method Details
-
all
public static List<io.modelcontextprotocol.server.McpServerFeatures.SyncCompletionSpecification> all()Retrieves all completion specifications from methods annotated with completion annotations.This static method scans for all methods annotated with either
McpPromptCompletionorMcpResourceCompletionannotations and creates completion specifications for each. The resulting specifications can be registered with an MCP server to provide auto-completion functionality.The method uses reflection to discover annotated methods and creates specifications through the
from(Method)method.- Returns:
- a list of synchronous completion specifications for all discovered completion methods
- See Also:
-
McpPromptCompletionMcpResourceCompletionMcpServerFeatures.SyncCompletionSpecification
-