Class SyncMcpResourceListChangedProvider
java.lang.Object
org.springaicommunity.mcp.provider.changed.resource.SyncMcpResourceListChangedProvider
Provider for synchronous resource list changed consumer callbacks.
This class scans a list of objects for methods annotated with
McpResourceListChanged and creates Consumer callbacks for them. These
callbacks can be used to handle resource list change notifications from MCP servers.
Example usage:
// Create a provider with a list of objects containing @McpResourceListChanged methods
SyncMcpResourceListChangedProvider provider = new SyncMcpResourceListChangedProvider(List.of(resourceListHandler));
// Get the list of resource list changed consumer callbacks
List<SyncResourceListChangedSpecification> specifications = provider.getResourceListChangedSpecifications();
// Add the consumers to the client features
McpClientFeatures.Sync clientFeatures = new McpClientFeatures.Sync(
clientInfo, clientCapabilities, roots,
toolsChangeConsumers, resourcesChangeConsumers, promptsChangeConsumers,
loggingConsumers, samplingHandler);
- Author:
- Christian Tzolov
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSyncMcpResourceListChangedProvider(List<Object> resourceListChangedConsumerObjects) Create a new SyncMcpResourceListChangedProvider. -
Method Summary
Modifier and TypeMethodDescriptionprotected Method[]doGetClassMethods(Object bean) Returns the methods of the given bean class.Get the list of resource list changed consumer specifications.
-
Constructor Details
-
SyncMcpResourceListChangedProvider
Create a new SyncMcpResourceListChangedProvider.- Parameters:
resourceListChangedConsumerObjects- the objects containing methods annotated withMcpResourceListChanged
-
-
Method Details
-
getResourceListChangedSpecifications
Get the list of resource list changed consumer specifications.- Returns:
- the list of resource list changed consumer specifications
-
doGetClassMethods
Returns the methods of the given bean class.- Parameters:
bean- the bean instance- Returns:
- the methods of the bean class
-