feat: organize tool schemas by category
All checks were successful
Deploy to OCIWP / deploy (push) Successful in 1m58s
All checks were successful
Deploy to OCIWP / deploy (push) Successful in 1m58s
This commit is contained in:
@@ -31,6 +31,6 @@ public @interface McpValidation {
|
||||
int maxLength() default -1;
|
||||
String[] allowedValues() default {};
|
||||
String format() default "";
|
||||
String defaultValue() default "";
|
||||
boolean nullable() default false; String defaultValue() default "";
|
||||
String[] examples() default {};
|
||||
}
|
||||
|
||||
@@ -103,6 +103,14 @@ public class JsonSchemaGenerator {
|
||||
if (validation != null && validation.examples().length > 0) {
|
||||
fieldSchema.put("examples", List.of(validation.examples()));
|
||||
}
|
||||
if (validation != null && validation.nullable()) {
|
||||
Map<String, Object> nonNullSchema = new HashMap<>(fieldSchema);
|
||||
fieldSchema = new HashMap<>();
|
||||
fieldSchema.put("anyOf", List.of(
|
||||
nonNullSchema,
|
||||
Map.of("type", "null")
|
||||
));
|
||||
}
|
||||
|
||||
properties.put(field.getName(), fieldSchema);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user