Class AsyncMcpLoggingProvider
java.lang.Object
org.springaicommunity.mcp.provider.logging.AsyncMcpLoggingProvider
Provider for asynchronous logging consumer callbacks.
This class scans a list of objects for methods annotated with McpLogging and
creates Function callbacks for them. These callbacks can be used to handle
logging message notifications from MCP servers in a reactive way.
Example usage:
// Create a provider with a list of objects containing @McpLoggingConsumer methods
AsyncMcpLoggingConsumerProvider provider = new AsyncMcpLoggingConsumerProvider(List.of(loggingHandler));
// Get the list of logging consumer callbacks
List<Function<LoggingMessageNotification, Mono<Void>>> consumers = provider.getLoggingConsumers();
// Add the consumers to the client features
McpClientFeatures.Async clientFeatures = new McpClientFeatures.Async(
clientInfo, clientCapabilities, roots,
toolsChangeConsumers, resourcesChangeConsumers, promptsChangeConsumers,
consumers, samplingHandler);
- Author:
- Christian Tzolov
- See Also:
-
McpLoggingAsyncMcpLoggingMethodCallbackMcpSchema.LoggingMessageNotification
-
Constructor Summary
ConstructorsConstructorDescriptionAsyncMcpLoggingProvider(List<Object> loggingConsumerObjects) Create a new AsyncMcpLoggingConsumerProvider. -
Method Summary
Modifier and TypeMethodDescriptionprotected Method[]doGetClassMethods(Object bean) Returns the methods of the given bean class.Get the list of logging consumer callbacks.
-
Constructor Details
-
AsyncMcpLoggingProvider
Create a new AsyncMcpLoggingConsumerProvider.- Parameters:
loggingConsumerObjects- the objects containing methods annotated withMcpLogging
-
-
Method Details
-
getLoggingSpecifications
Get the list of logging consumer callbacks.- Returns:
- the list of logging consumer callbacks
-
doGetClassMethods
Returns the methods of the given bean class.- Parameters:
bean- the bean instance- Returns:
- the methods of the bean class
-