Class SyncMcpResourceListChangedMethodCallback
java.lang.Object
org.springaicommunity.mcp.method.changed.resource.AbstractMcpResourceListChangedMethodCallback
org.springaicommunity.mcp.method.changed.resource.SyncMcpResourceListChangedMethodCallback
public final class SyncMcpResourceListChangedMethodCallback
extends AbstractMcpResourceListChangedMethodCallback
implements Consumer<List<io.modelcontextprotocol.spec.McpSchema.Resource>>
Class for creating Consumer callbacks around resource list changed consumer methods.
This class provides a way to convert methods annotated with
McpResourceListChanged into callback functions that can be used to handle
resource list change notifications. It supports methods with a single
List<McpSchema.Resource> parameter.- Author:
- Christian Tzolov
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for creating SyncMcpResourceListChangedMethodCallback instances.Nested classes/interfaces inherited from class org.springaicommunity.mcp.method.changed.resource.AbstractMcpResourceListChangedMethodCallback
AbstractMcpResourceListChangedMethodCallback.AbstractBuilder<T extends AbstractMcpResourceListChangedMethodCallback.AbstractBuilder<T,R>, R>, AbstractMcpResourceListChangedMethodCallback.McpResourceListChangedConsumerMethodException -
Field Summary
Fields inherited from class org.springaicommunity.mcp.method.changed.resource.AbstractMcpResourceListChangedMethodCallback
bean, method -
Method Summary
Modifier and TypeMethodDescriptionvoidAccept the resource list change notification and process it.builder()Create a new builder.protected voidvalidateReturnType(Method method) Validates that the method return type is compatible with the resource list changed consumer callback.Methods inherited from class org.springaicommunity.mcp.method.changed.resource.AbstractMcpResourceListChangedMethodCallback
buildArgs, validateMethod, validateParameters
-
Method Details
-
accept
Accept the resource list change notification and process it.This method builds the arguments for the method call and invokes the method.
- Specified by:
acceptin interfaceConsumer<List<io.modelcontextprotocol.spec.McpSchema.Resource>>- Parameters:
updatedResources- The updated list of resources, must not be null- Throws:
AbstractMcpResourceListChangedMethodCallback.McpResourceListChangedConsumerMethodException- if there is an error invoking the resource list changed consumer methodIllegalArgumentException- if the updatedResources is null
-
validateReturnType
Validates that the method return type is compatible with the resource list changed consumer callback.- Specified by:
validateReturnTypein classAbstractMcpResourceListChangedMethodCallback- Parameters:
method- The method to validate- Throws:
IllegalArgumentException- if the return type is not compatible
-
builder
Create a new builder.- Returns:
- A new builder instance
-