toJsonSchema

fun SerialDescriptor.toJsonSchema(strict: Boolean = false): JsonObject

Generates a JSON Schema JsonObject from a serializable class descriptor.

Each element is mapped to a JSON Schema property with:

  • "type" derived from the element's SerialKind via toJsonType.

  • "description" from the @ToolParam annotation, if present and non-blank.

Required fields (non-optional properties) are listed in the "required" array.

Return

A JSON Schema object with "type": "object", "properties", and optionally "required".