类 McpServerCompletion
java.lang.Object
com.github.codeboyzhou.mcp.declarative.server.component.AbstractMcpServerComponent<io.modelcontextprotocol.server.McpServerFeatures.SyncCompletionSpecification>
com.github.codeboyzhou.mcp.declarative.server.component.McpServerCompletion
- 所有已实现的接口:
McpServerComponent<io.modelcontextprotocol.server.McpServerFeatures.SyncCompletionSpecification>
public class McpServerCompletion
extends AbstractMcpServerComponent<io.modelcontextprotocol.server.McpServerFeatures.SyncCompletionSpecification>
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.
- 作者:
- codeboyzhou
-
字段概要
从类继承的字段 com.github.codeboyzhou.mcp.declarative.server.component.AbstractMcpServerComponent
injector -
构造器概要
构造器 -
方法概要
从类继承的方法 com.github.codeboyzhou.mcp.declarative.server.component.AbstractMcpServerComponent
localizeAttribute
-
构造器详细资料
-
McpServerCompletion
public McpServerCompletion()
-
-
方法详细资料
-
create
public io.modelcontextprotocol.server.McpServerFeatures.SyncCompletionSpecification create(Method method) Creates a synchronous completion specification for the given method.This method validates the method signature to ensure it meets the requirements for completion handlers, then creates a
McpServerFeatures.SyncCompletionSpecificationthat can be registered with the MCP server.The method must:
- Return
McpCompleteCompletion - Have exactly one parameter of type
McpSchema.CompleteRequest.CompleteArgument - Be annotated with either
McpPromptCompletionorMcpResourceCompletion
- 参数:
method- the method to create completion specification for- 返回:
- a synchronous completion specification for the MCP server
- 抛出:
McpServerComponentRegistrationException- if the method signature is invalid
- Return
-