Class AsyncMcpProgressProvider
java.lang.Object
org.springaicommunity.mcp.provider.progress.AsyncMcpProgressProvider
Provider for asynchronous progress callbacks.
This class scans a list of objects for methods annotated with McpProgress and
creates Function callbacks for them. These callbacks can be used to handle
progress notifications from MCP servers asynchronously.
Example usage:
// Create a provider with a list of objects containing @McpProgress methods
AsyncMcpProgressProvider provider = new AsyncMcpProgressProvider(List.of(progressHandler));
// Get the list of progress callbacks
List<AsyncProgressSpecification> progressSpecs = provider.getProgressSpecifications();
// Add the functions to the client features
McpClientFeatures.Async clientFeatures = new McpClientFeatures.Async(
clientInfo, clientCapabilities, roots,
toolsChangeConsumers, resourcesChangeConsumers, promptsChangeConsumers,
loggingConsumers, progressHandlers, samplingHandler);
- Author:
- Christian Tzolov
- See Also:
-
McpProgressAsyncMcpProgressMethodCallbackMcpSchema.ProgressNotification
-
Constructor Summary
ConstructorsConstructorDescriptionAsyncMcpProgressProvider(List<Object> progressObjects) Create a new AsyncMcpProgressProvider. -
Method Summary
Modifier and TypeMethodDescriptionprotected Method[]doGetClassMethods(Object bean) Returns the methods of the given bean class.Get the list of progress specifications.
-
Constructor Details
-
AsyncMcpProgressProvider
Create a new AsyncMcpProgressProvider.- Parameters:
progressObjects- the objects containing methods annotated withMcpProgress
-
-
Method Details
-
getProgressSpecifications
Get the list of progress specifications.- Returns:
- the list of progress specifications
-
doGetClassMethods
Returns the methods of the given bean class.- Parameters:
bean- the bean instance- Returns:
- the methods of the bean class
-