Class SyncMcpProgressMethodCallback
java.lang.Object
org.springaicommunity.mcp.method.progress.AbstractMcpProgressMethodCallback
org.springaicommunity.mcp.method.progress.SyncMcpProgressMethodCallback
- All Implemented Interfaces:
Consumer<io.modelcontextprotocol.spec.McpSchema.ProgressNotification>
public final class SyncMcpProgressMethodCallback
extends AbstractMcpProgressMethodCallback
implements Consumer<io.modelcontextprotocol.spec.McpSchema.ProgressNotification>
Synchronous implementation of a progress method callback.
This class creates a Consumer that invokes a method annotated with @McpProgress
synchronously when a progress notification is received.
- Author:
- Christian Tzolov
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for creating SyncMcpProgressMethodCallback 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 TypeMethodDescriptionvoidaccept(io.modelcontextprotocol.spec.McpSchema.ProgressNotification notification) Accept the progress notification and process it.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
-
accept
public void accept(io.modelcontextprotocol.spec.McpSchema.ProgressNotification notification) Accept the progress notification and process it.This method builds the arguments for the method call and invokes the method.
- Specified by:
acceptin interfaceConsumer<io.modelcontextprotocol.spec.McpSchema.ProgressNotification>- Parameters:
notification- The progress notification, must not be null- 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
-