Class SyncMcpProgressProvider
java.lang.Object
org.springaicommunity.mcp.provider.progress.SyncMcpProgressProvider
Provider for synchronous progress callbacks.
This class scans a list of objects for methods annotated with McpProgress and
creates Consumer callbacks for them. These callbacks can be used to handle
progress notifications from MCP servers.
Example usage:
// Create a provider with a list of objects containing @McpProgress methods
SyncMcpProgressProvider provider = new SyncMcpProgressProvider(List.of(progressHandler));
// Get the list of progress callbacks
List<SyncProgressSpecification> progressSpecs = provider.getProgressSpecifications();
// Add the consumers to the client features
McpClientFeatures.Sync clientFeatures = new McpClientFeatures.Sync(
clientInfo, clientCapabilities, roots,
toolsChangeConsumers, resourcesChangeConsumers, promptsChangeConsumers,
loggingConsumers, progressConsumers, samplingHandler);
- Author:
- Christian Tzolov
- See Also:
-
McpProgressSyncMcpProgressMethodCallbackMcpSchema.ProgressNotification
-
Constructor Summary
ConstructorsConstructorDescriptionSyncMcpProgressProvider(List<Object> progressObjects) Create a new SyncMcpProgressProvider. -
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
-
SyncMcpProgressProvider
Create a new SyncMcpProgressProvider.- 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
-