Class AsyncModernMcpCompleteProvider

java.lang.Object
org.springframework.ai.mcp.annotation.provider.complete.AsyncModernMcpCompleteProvider

public class AsyncModernMcpCompleteProvider extends Object
The asynchronous twin of SyncModernMcpCompleteProvider: creates the completion handlers of a 2026-07-28 ("modern") MCP server from methods annotated with McpComplete. Each method is served by an AsyncModernMcpCompleteMethodCallback.

A handler completes every argument of the prompt or resource template that its annotation names, and answers only once it is attached to that prompt or template with McpAsyncPrompt.withCompletionHandler or AsyncResourceTemplateRegistration.withCompletionHandler. The Spring entry points attach them to the annotated prompts and templates.

Since:
2.1.0
Author:
Christian Tzolov
  • Constructor Details

    • AsyncModernMcpCompleteProvider

      public AsyncModernMcpCompleteProvider(List<Object> completeObjects)
  • Method Details

    • getPromptCompletions

      public Map<String,io.modelcontextprotocol.modern.server.feature.McpAsyncCompletionHandler> getPromptCompletions()
      The handlers of the @McpComplete(prompt = ...) methods, keyed by prompt name.
      Throws:
      IllegalArgumentException - if two methods complete the same prompt
    • getResourceCompletions

      public Map<String,io.modelcontextprotocol.modern.server.feature.McpAsyncCompletionHandler> getResourceCompletions()
      The handlers of the @McpComplete(uri = ...) methods, keyed by URI template.
      Throws:
      IllegalArgumentException - if two methods complete the same URI template
    • doGetClassMethods

      protected Method[] doGetClassMethods(Object bean)