Class JsonSchemaUtils
java.lang.Object
org.springframework.ai.util.json.schema.JsonSchemaUtils
Utility methods for working with JSON schemas.
- Since:
- 1.0.0
- Author:
- Guangdong Liu, Ilayaperumal Gopinathan
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringensureValidInputSchema(String inputSchema) Ensures that the input schema is valid for AI model APIs.
-
Method Details
-
ensureValidInputSchema
Ensures that the input schema is valid for AI model APIs. Many AI models require that the parameters object must have a "properties" field, even if it's empty. This method normalizes schemas from external sources (like MCP tools) that may not include this field.- Parameters:
inputSchema- the input schema as a JSON string- Returns:
- a valid input schema as a JSON string with required fields
-