Annotation Interface McpResourceCompletion


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

This annotation is used to identify methods that can handle completion requests for specific resources 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 resource URI.

Methods annotated with @McpResourceCompletion must:

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

The annotation is retained at runtime and can only be applied to methods. Resource completion is typically used to provide suggestions for resource identifiers, file paths, or other resource-specific parameters.

Author:
codeboyzhou
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Specifies the URI of the resource for which completion is provided.
  • Element Details

    • uri

      String uri
      Specifies the URI of the resource for which completion is provided.

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

      The URI string must be non-null and non-empty. It should uniquely identify the resource within the MCP server context.

      Returns:
      the URI of the resource for which completion is provided