Class AsyncMcpResourceListChangedProvider
java.lang.Object
org.springaicommunity.mcp.provider.changed.resource.AsyncMcpResourceListChangedProvider
Provider for asynchronous resource list changed consumer callbacks.
This class scans a list of objects for methods annotated with
McpResourceListChanged and creates Function callbacks for them. These
callbacks can be used to handle resource list change notifications from MCP servers in
a reactive way.
Example usage:
// Create a provider with a list of objects containing @McpResourceListChanged methods
AsyncMcpResourceListChangedProvider provider = new AsyncMcpResourceListChangedProvider(List.of(resourceListHandler));
// Get the list of resource list changed consumer callbacks
List<AsyncResourceListChangedSpecification> specifications = provider.getResourceListChangedSpecifications();
// Add the consumers to the client features
McpClientFeatures.Async clientFeatures = new McpClientFeatures.Async(
clientInfo, clientCapabilities, roots,
toolsChangeConsumers, resourcesChangeConsumers, promptsChangeConsumers,
loggingConsumers, samplingHandler);
- Author:
- Christian Tzolov
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAsyncMcpResourceListChangedProvider(List<Object> resourceListChangedConsumerObjects) Create a new AsyncMcpResourceListChangedProvider. -
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
-
AsyncMcpResourceListChangedProvider
Create a new AsyncMcpResourceListChangedProvider.- 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
-