This PR modifies the serialization info of a tool to allow descriptions in the enum values. So for the following structure:
@Description("Natural numbers")
enum class NaturalWithDescriptions {
@Description("If the number is positive.") POSITIVE,
@Description("If the number is negative.") NEGATIVE
}
@Serializable
data class SumInputWithDescription(
@Description("Left operand") val left: Int,
@Description("Right operand") val right: Int,
val natural: NaturalWithDescriptions
)
class SumToolWithDescription : Tool<SumInputWithDescription, Int> {
override suspend fun invoke(input: SumInputWithDescription): Int {
return input.left + input.right
}
}
The serialization will be:
{
"$schema": "http://json-schema.org/draft-07/schema",
"type": "object",
"properties": {
"left": {
"type": "number",
"description": "Left operand"
},
"right": {
"type": "number",
"description": "Right operand"
},
"natural": {
"type": "string",
"enum": [
"POSITIVE",
"NEGATIVE"
],
"description": "Natural numbers\n - POSITIVE (If the number is positive.)\n - NEGATIVE (If the number is negative.)"
}
},
"required": [
"left",
"right",
"natural"
],
"definitions": {}
}
This PR modifies the serialization info of a tool to allow descriptions in the enum values. So for the following structure:
The serialization will be: