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:
@@ -43,11 +43,11 @@ public class ClaimSearchResponse {
|
||||
private String statusLabel;
|
||||
|
||||
@McpParameter(description = "Approved amount. Null before review; do not interpret null as zero.")
|
||||
@McpValidation(minimum = 0)
|
||||
@McpValidation(minimum = 0, nullable = true)
|
||||
private Long approvedAmount;
|
||||
|
||||
@McpParameter(description = "Present only when status is REJECTED; otherwise null.")
|
||||
@McpValidation(maxLength = 200)
|
||||
@McpValidation(maxLength = 200, nullable = true)
|
||||
private String rejectionReason;
|
||||
|
||||
@McpParameter(description = "Claim summaries, ordered by received date descending.")
|
||||
@@ -82,7 +82,7 @@ public class ClaimSearchResponse {
|
||||
private String receivedDate;
|
||||
|
||||
@McpParameter(description = "Approved amount. Null before review; do not interpret null as zero.")
|
||||
@McpValidation(minimum = 0)
|
||||
@McpValidation(minimum = 0, nullable = true)
|
||||
private Long approvedAmount;
|
||||
}
|
||||
}
|
||||
@@ -17,8 +17,8 @@ public interface ClaimSearchSchemaSampleUseCase {
|
||||
name = "sample.claim.search.resource",
|
||||
description = "Claim search Tool sample using input and output JSON Schema resources.",
|
||||
prompt = "Search an insurance claim by claim number or contract number.",
|
||||
inputSchemaResource = "classpath:tool-schemas/claim-search-resource-input-schema.json",
|
||||
|
||||
inputSchemaResource = "classpath:tool-schemas/cmm/claim-search-resource-input-schema.json",
|
||||
outputSchemaResource = "classpath:tool-schemas/cmm/claim-search-resource-output-schema.json",
|
||||
readOnlyHint = true,
|
||||
idempotentHint = true
|
||||
)
|
||||
|
||||
@@ -69,6 +69,14 @@ class ClaimSearchRequestSchemaTest {
|
||||
|
||||
assertTrue(validator.validateValue(schema, response).isEmpty());
|
||||
}
|
||||
@Test
|
||||
void sampleResponseConformsToAutomaticallyGeneratedOutputSchema() throws Exception {
|
||||
Map<String, Object> schema = JsonSchemaGenerator.generateSchema(ClaimSearchResponse.class);
|
||||
ClaimSearchResponse response = new ClaimSearchSchemaSampleUseCaseImpl().search(new ClaimSearchRequest());
|
||||
ToolArgumentSchemaValidator validator = new ToolArgumentSchemaValidator(new ObjectMapper());
|
||||
|
||||
assertTrue(validator.validateValue(schema, response).isEmpty());
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
private Map<String, Map<String, Object>> properties(Map<String, Object> schema) {
|
||||
return (Map<String, Map<String, Object>>) schema.get("properties");
|
||||
|
||||
Reference in New Issue
Block a user