Annotation Interface McpPromptCompletion


@Target(METHOD) @Retention(RUNTIME) public @interface McpPromptCompletion
Annotation for marking methods that provide completion functionality for MCP prompts.

This annotation is used to identify methods that can handle completion requests for specific prompts in the Model Context Protocol (MCP) server. When applied to a method, it indicates that the method can provide auto-completion suggestions for the specified prompt.

Methods annotated with @McpPromptCompletion must:

  • Return McpCompleteCompletion
  • Accept exactly one parameter of type McpSchema.CompleteRequest.CompleteArgument
  • Be properly configured with a prompt name

The annotation is retained at runtime and can only be applied to methods.

Author:
codeboyzhou
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Specifies the name of the prompt for which completion is provided.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Specifies an optional title or description for the prompt completion.
  • Element Details

    • name

      String name
      Specifies the name of the prompt for which completion is provided.

      This value must match the name of an existing prompt that has been registered with the MCP server. The completion method will be invoked when completion requests are made for this specific prompt.

      The name should be a non-empty string that follows the MCP naming conventions for prompts.

      Returns:
      the name of the prompt for which completion is provided
    • title

      String title
      Specifies an optional title or description for the prompt completion.

      This field provides a human-readable title or description for the completion functionality. It can be used in documentation, UI displays, or logging to provide more context about what the completion does.

      If not specified, defaults to an empty string using StringHelper.EMPTY. This allows the title to be optional while maintaining consistency across the codebase.

      Returns:
      the title or description for the prompt completion, defaults to empty string if not specified
      Default:
      ""