Class McpJsonSchemaGenerator

java.lang.Object
org.springframework.ai.mcp.annotation.method.tool.utils.McpJsonSchemaGenerator

public final class McpJsonSchemaGenerator extends Object
  • Method Details

    • generateForMethodInput

      public static String generateForMethodInput(Method method)
    • generateFromClass

      public static String generateFromClass(Class<?> clazz)
      Generate a JSON Schema for a class type. Delegates to JsonSchemaGenerator.generateForType(java.lang.reflect.Type, org.springframework.ai.util.json.schema.JsonSchemaGenerator.SchemaOption...).
      Parameters:
      clazz - the class to generate a schema for
      Returns:
      the JSON Schema as a string
    • generateFromType

      public static String generateFromType(Type type)
      Generate a JSON Schema for a generic type. Delegates to JsonSchemaGenerator.generateForType(java.lang.reflect.Type, org.springframework.ai.util.json.schema.JsonSchemaGenerator.SchemaOption...).
      Parameters:
      type - the type to generate a schema for
      Returns:
      the JSON Schema as a string
    • hasCallToolRequestParameter

      public static boolean hasCallToolRequestParameter(Method method)
      Check if a method has a CallToolRequest parameter.
      Parameters:
      method - The method to check
      Returns:
      true if the method has a CallToolRequest parameter, false otherwise