Class AsyncMcpToolListChangedMethodCallback
java.lang.Object
org.springaicommunity.mcp.method.changed.tool.AbstractMcpToolListChangedMethodCallback
org.springaicommunity.mcp.method.changed.tool.AsyncMcpToolListChangedMethodCallback
- All Implemented Interfaces:
Function<List<io.modelcontextprotocol.spec.McpSchema.Tool>,reactor.core.publisher.Mono<Void>>
public final class AsyncMcpToolListChangedMethodCallback
extends AbstractMcpToolListChangedMethodCallback
implements Function<List<io.modelcontextprotocol.spec.McpSchema.Tool>,reactor.core.publisher.Mono<Void>>
Class for creating Function callbacks around tool list changed consumer methods that
return Mono.
This class provides a way to convert methods annotated with
McpToolListChanged
into callback functions that can be used to handle tool list change notifications in a
reactive way. It supports methods with a single List<McpSchema.Tool> parameter.- Author:
- Christian Tzolov
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for creating AsyncMcpToolListChangedMethodCallback instances.Nested classes/interfaces inherited from class org.springaicommunity.mcp.method.changed.tool.AbstractMcpToolListChangedMethodCallback
AbstractMcpToolListChangedMethodCallback.AbstractBuilder<T extends AbstractMcpToolListChangedMethodCallback.AbstractBuilder<T,R>, R>, AbstractMcpToolListChangedMethodCallback.McpToolListChangedConsumerMethodException -
Field Summary
Fields inherited from class org.springaicommunity.mcp.method.changed.tool.AbstractMcpToolListChangedMethodCallback
bean, method -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void>Apply the callback to the given tool list.builder()Create a new builder.protected voidvalidateReturnType(Method method) Validates that the method return type is compatible with the tool list changed consumer callback.Methods inherited from class org.springaicommunity.mcp.method.changed.tool.AbstractMcpToolListChangedMethodCallback
buildArgs, validateMethod, validateParameters
-
Method Details
-
apply
public reactor.core.publisher.Mono<Void> apply(List<io.modelcontextprotocol.spec.McpSchema.Tool> updatedTools) Apply the callback to the given tool list.This method builds the arguments for the method call, invokes the method, and returns a Mono that completes when the method execution is done.
- Specified by:
applyin interfaceFunction<List<io.modelcontextprotocol.spec.McpSchema.Tool>,reactor.core.publisher.Mono<Void>> - Parameters:
updatedTools- The updated list of tools, must not be null- Returns:
- A Mono that completes when the method execution is done
- Throws:
AbstractMcpToolListChangedMethodCallback.McpToolListChangedConsumerMethodException- if there is an error invoking the tool list changed consumer methodIllegalArgumentException- if the updatedTools is null
-
validateReturnType
Validates that the method return type is compatible with the tool list changed consumer callback.- Specified by:
validateReturnTypein classAbstractMcpToolListChangedMethodCallback- 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
-