validate_response
Validates parsed JSON against a shape spec to enforce structured output. Returns validation result with human-readable error for retry feedback.
Instructions
Validate a parsed JSON value against an agentcast shape spec. Spec maps field name to type: 'string', 'number', 'boolean', 'array', 'object'. Suffix with '?' for optional. Returns valid=true on success, or valid=false with a human-readable error string suitable for retry feedback.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| shape | Yes | Shape spec: { fieldName: 'string' | 'number' | 'boolean' | 'array' | 'object', ... }. Append '?' for optional fields, e.g. { name: 'string', age: 'number?' }. | |
| value | Yes | The parsed JSON value to validate (any shape). |