Class AsyncMcpToolListChangedProvider
java.lang.Object
org.springaicommunity.mcp.provider.changed.tool.AsyncMcpToolListChangedProvider
Provider for asynchronous tool list changed consumer callbacks.
This class scans a list of objects for methods annotated with
McpToolListChanged and creates Function callbacks for them. These
callbacks can be used to handle tool list change notifications from MCP servers in a
reactive way.
Example usage:
// Create a provider with a list of objects containing @McpToolListChanged methods
AsyncMcpToolListChangedProvider provider = new AsyncMcpToolListChangedProvider(List.of(toolListHandler));
// Get the list of tool list changed consumer callbacks
List<AsyncToolListChangedSpecification> specifications = provider.getToolListChangedSpecifications();
// 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
ConstructorsConstructorDescriptionAsyncMcpToolListChangedProvider(List<Object> toolListChangedConsumerObjects) Create a new AsyncMcpToolListChangedProvider. -
Method Summary
Modifier and TypeMethodDescriptionprotected Method[]doGetClassMethods(Object bean) Returns the methods of the given bean class.Get the list of tool list changed consumer specifications.
-
Constructor Details
-
AsyncMcpToolListChangedProvider
Create a new AsyncMcpToolListChangedProvider.- Parameters:
toolListChangedConsumerObjects- the objects containing methods annotated withMcpToolListChanged
-
-
Method Details
-
getToolListChangedSpecifications
Get the list of tool list changed consumer specifications.- Returns:
- the list of tool 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
-