Class SyncMcpPromptListChangedMethodCallback
java.lang.Object
org.springaicommunity.mcp.method.changed.prompt.AbstractMcpPromptListChangedMethodCallback
org.springaicommunity.mcp.method.changed.prompt.SyncMcpPromptListChangedMethodCallback
public final class SyncMcpPromptListChangedMethodCallback
extends AbstractMcpPromptListChangedMethodCallback
implements Consumer<List<io.modelcontextprotocol.spec.McpSchema.Prompt>>
Class for creating Consumer callbacks around prompt list changed consumer methods.
This class provides a way to convert methods annotated with
McpPromptListChanged into callback functions that can be used to handle prompt
list change notifications. It supports methods with a single
List<McpSchema.Prompt> parameter.- Author:
- Christian Tzolov
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for creating SyncMcpPromptListChangedMethodCallback instances.Nested classes/interfaces inherited from class org.springaicommunity.mcp.method.changed.prompt.AbstractMcpPromptListChangedMethodCallback
AbstractMcpPromptListChangedMethodCallback.AbstractBuilder<T extends AbstractMcpPromptListChangedMethodCallback.AbstractBuilder<T,R>, R>, AbstractMcpPromptListChangedMethodCallback.McpPromptListChangedConsumerMethodException -
Field Summary
Fields inherited from class org.springaicommunity.mcp.method.changed.prompt.AbstractMcpPromptListChangedMethodCallback
bean, method -
Method Summary
Modifier and TypeMethodDescriptionvoidAccept the prompt 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 prompt list changed consumer callback.Methods inherited from class org.springaicommunity.mcp.method.changed.prompt.AbstractMcpPromptListChangedMethodCallback
buildArgs, validateMethod, validateParameters
-
Method Details
-
accept
Accept the prompt 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.Prompt>>- Parameters:
updatedPrompts- The updated list of prompts, must not be null- Throws:
AbstractMcpPromptListChangedMethodCallback.McpPromptListChangedConsumerMethodException- if there is an error invoking the prompt list changed consumer methodIllegalArgumentException- if the updatedPrompts is null
-
validateReturnType
Validates that the method return type is compatible with the prompt list changed consumer callback.- Specified by:
validateReturnTypein classAbstractMcpPromptListChangedMethodCallback- 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
-