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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for creating AsyncMcpProgressMethodCallback instances.Nested classes/interfaces inherited from class org.springaicommunity.mcp.method.progress.AbstractMcpProgressMethodCallback
AbstractMcpProgressMethodCallback.AbstractBuilder<T extends AbstractMcpProgressMethodCallback.AbstractBuilder<T,R>, R>, AbstractMcpProgressMethodCallback.McpProgressMethodException -
Field Summary
Fields inherited from class org.springaicommunity.mcp.method.progress.AbstractMcpProgressMethodCallback
bean, method -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void>apply(io.modelcontextprotocol.spec.McpSchema.ProgressNotification notification) Apply the progress notification and process it asynchronously.builder()Create a new builder.protected voidvalidateReturnType(Method method) Validates that the method return type is compatible with the progress callback.Methods inherited from class org.springaicommunity.mcp.method.progress.AbstractMcpProgressMethodCallback
buildArgs, validateMethod, validateParameters
-
Method Details
-
validateReturnType
Description copied from class:AbstractMcpProgressMethodCallbackValidates 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:
validateReturnTypein classAbstractMcpProgressMethodCallback- 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:
applyin interfaceFunction<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 methodIllegalArgumentException- if the notification is null
-
builder
Create a new builder.- Returns:
- A new builder instance
-