java.lang.Object
org.springframework.ai.mcp.annotation.common.MetaUtils

public final class MetaUtils extends Object
Utility methods for working with MetaProvider metadata.

This class provides a single entry point getMeta(Class) that instantiates the given provider type via a no-argument constructor and returns its metadata as an unmodifiable Map.

Instantiation failures and missing no-arg constructors are reported as IllegalArgumentExceptions. This class is stateless and not intended to be instantiated.

Author:
Vadzim Shurmialiou, Craig Walls
  • Method Details

    • getMeta

      public static Map<String,Object> getMeta(Class<? extends MetaProvider> metaProviderClass)
      Instantiate the supplied MetaProvider type using a no-argument constructor and return the metadata it supplies.

      The returned map is wrapped in Collections.unmodifiableMap(Map) to prevent external modification. If the provider returns null, this method also returns null.

      Parameters:
      metaProviderClass - the MetaProvider implementation class to instantiate; must provide a no-arg constructor
      Returns:
      an unmodifiable metadata map, or null if the provider returns null
      Throws:
      IllegalArgumentException - if a no-arg constructor is missing or the instance cannot be created