JSON Schema Validation

Validate JSON against a JSON Schema and get each error with its path and message.

Pay by wallet (x402) json-schema-validate

Example

Example answer
{
  "valid": true,
  "errors": [],
  "error_count": 0
}

Inputs

FieldTypeRequiredWhat it is
dataanyYesJSON data to validate
schemaobjectYesJSON Schema to validate against

Output fields

How reliably each field appears in a successful answer.

FieldTypeAppears
validbooleanAlways (present in every successful answer)
errorsarrayAlways (present in every successful answer)
error_countintegerAlways (present in every successful answer)

How to call it

The same tool through each route. MCP clients reach it through Strale’s server at https://api.strale.io/mcp; the call below is what the agent sends.

# Needs an API key. max_price_cents caps what this call may cost.
curl -X POST https://api.strale.io/v1/do \
  -H "Authorization: Bearer $STRALE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "capability_slug": "json-schema-validate",
    "inputs": {
      "data": {
        "age": 30,
        "name": "Alice"
      },
      "schema": {
        "type": "object",
        "properties": {
          "age": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          }
        }
      }
    },
    "max_price_cents": 2
  }'

Limitations

  • Only JSON Schema Draft-07 is supported

    Validates against JSON Schema Draft-07 — newer drafts (2019-09, 2020-12) may have features not fully supported

    What to do instead: Specify your target draft version and test edge cases with draft-specific keywords like $dynamicRef

Related tools