Class McpHints

java.lang.Object
org.springframework.ai.mcp.aot.McpHints
All Implemented Interfaces:
org.springframework.aot.hint.RuntimeHintsRegistrar

public class McpHints extends Object implements org.springframework.aot.hint.RuntimeHintsRegistrar
Runtime hints registrar for Model Context Protocol (MCP) schema classes.

This class provides GraalVM native image hints for MCP schema classes to ensure proper reflection access in native images. It:

  • Registers all nested classes of McpSchema for reflection
  • Enables all member categories (fields, methods, etc.) for registered types
  • Ensures proper serialization/deserialization in native images
Since:
1.0.0
Author:
Josh Long
See Also:
  • RuntimeHintsRegistrar
  • McpSchema
  • Constructor Details

    • McpHints

      public McpHints()
  • Method Details

    • registerHints

      public void registerHints(org.springframework.aot.hint.RuntimeHints hints, @Nullable ClassLoader classLoader)
      Registers runtime hints for MCP schema classes.

      This method:

      1. Discovers all nested classes within McpSchema
      2. Registers each discovered class for reflection access
      3. Enables all member categories for complete reflection support
      Specified by:
      registerHints in interface org.springframework.aot.hint.RuntimeHintsRegistrar
      Parameters:
      hints - the hints instance to register hints with
      classLoader - the classloader to use (may be null)