feat: organize tool schemas by category
All checks were successful
Deploy to OCIWP / deploy (push) Successful in 1m58s

This commit is contained in:
jade
2026-08-04 14:42:08 +09:00
parent 4393071212
commit 08ccc043da
7 changed files with 22 additions and 6 deletions

View File

@@ -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 {};
}

View File

@@ -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);
}