Class McpServerCompletion

java.lang.Object
com.github.thought2code.mcp.annotated.server.component.McpServerCompletion

public class McpServerCompletion extends Object
MCP server component for handling completion requests.

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 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 McpPromptCompletion or McpResourceCompletion annotations 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: