Class SyncMcpToolListChangedMethodCallback
java.lang.Object
org.springaicommunity.mcp.method.changed.tool.AbstractMcpToolListChangedMethodCallback
org.springaicommunity.mcp.method.changed.tool.SyncMcpToolListChangedMethodCallback
public final class SyncMcpToolListChangedMethodCallback
extends AbstractMcpToolListChangedMethodCallback
implements Consumer<List<io.modelcontextprotocol.spec.McpSchema.Tool>>
Class for creating Consumer callbacks around tool list changed consumer methods.
This class provides a way to convert methods annotated with
McpToolListChanged
into callback functions that can be used to handle tool list change notifications. It
supports methods with a single List<McpSchema.Tool> parameter.- Author:
- Christian Tzolov
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for creating SyncMcpToolListChangedMethodCallback 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 TypeMethodDescriptionvoidAccept the tool 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 tool list changed consumer callback.Methods inherited from class org.springaicommunity.mcp.method.changed.tool.AbstractMcpToolListChangedMethodCallback
buildArgs, validateMethod, validateParameters
-
Method Details
-
accept
Accept the tool 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.Tool>>- Parameters:
updatedTools- The updated list of tools, must not be null- 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
-