Class SyncMcpLogginProvider

java.lang.Object
org.springframework.ai.mcp.annotation.provider.logging.SyncMcpLogginProvider

@Deprecated public class SyncMcpLogginProvider extends Object
Deprecated.
Provider for synchronous logging consumer callbacks.

This class scans a list of objects for methods annotated with McpLogging and creates Consumer callbacks for them. These callbacks can be used to handle logging message notifications from MCP servers.

Example usage:

// Create a provider with a list of objects containing @McpLoggingConsumer methods
SyncMcpLoggingConsumerProvider provider = new SyncMcpLoggingConsumerProvider(List.of(loggingHandler));

// Get the list of logging consumer callbacks
List<Consumer<LoggingMessageNotification>> consumers = provider.getLoggingConsumers();

// Add the consumers to the client features
McpClientFeatures.Sync clientFeatures = new McpClientFeatures.Sync(
    clientInfo, clientCapabilities, roots,
    toolsChangeConsumers, resourcesChangeConsumers, promptsChangeConsumers,
    consumers, samplingHandler);
Author:
Christian Tzolov
See Also:
  • Constructor Details

    • SyncMcpLogginProvider

      public SyncMcpLogginProvider(List<Object> loggingConsumerObjects)
      Deprecated.
      Create a new SyncMcpLoggingConsumerProvider.
      Parameters:
      loggingConsumerObjects - the objects containing methods annotated with McpLogging
  • Method Details

    • getLoggingSpecifications

      public List<SyncLoggingSpecification> getLoggingSpecifications()
      Deprecated.
      Get the list of logging consumer callbacks.
      Returns:
      the list of logging consumer callbacks
    • doGetClassMethods

      protected Method[] doGetClassMethods(Object bean)
      Deprecated.
      Returns the methods of the given bean class.
      Parameters:
      bean - the bean instance
      Returns:
      the methods of the bean class