Class AsyncMcpProgressMethodCallback

java.lang.Object
org.springaicommunity.mcp.method.progress.AbstractMcpProgressMethodCallback
org.springaicommunity.mcp.method.progress.AsyncMcpProgressMethodCallback
All Implemented Interfaces:
Function<io.modelcontextprotocol.spec.McpSchema.ProgressNotification,reactor.core.publisher.Mono<Void>>

public final class AsyncMcpProgressMethodCallback extends AbstractMcpProgressMethodCallback implements Function<io.modelcontextprotocol.spec.McpSchema.ProgressNotification,reactor.core.publisher.Mono<Void>>
Asynchronous implementation of a progress method callback. This class creates a Function that invokes a method annotated with @McpProgress asynchronously when a progress notification is received, returning a Mono.
Author:
Christian Tzolov
  • Method Details

    • validateReturnType

      protected void validateReturnType(Method method)
      Description copied from class: AbstractMcpProgressMethodCallback
      Validates that the method return type is compatible with the progress callback. This method should be implemented by subclasses to handle specific return type validation.
      Specified by:
      validateReturnType in class AbstractMcpProgressMethodCallback
      Parameters:
      method - The method to validate
    • apply

      public reactor.core.publisher.Mono<Void> apply(io.modelcontextprotocol.spec.McpSchema.ProgressNotification notification)
      Apply the progress notification and process it asynchronously.

      This method builds the arguments for the method call and invokes the method, returning a Mono.

      Specified by:
      apply in interface Function<io.modelcontextprotocol.spec.McpSchema.ProgressNotification,reactor.core.publisher.Mono<Void>>
      Parameters:
      notification - The progress notification, must not be null
      Returns:
      A Mono representing the asynchronous operation
      Throws:
      AbstractMcpProgressMethodCallback.McpProgressMethodException - if there is an error invoking the progress method
      IllegalArgumentException - if the notification is null
    • builder

      public static AsyncMcpProgressMethodCallback.Builder builder()
      Create a new builder.
      Returns:
      A new builder instance