Schema Inference

Work out the schema of a JSON array or CSV: field types, nulls, uniqueness and completeness, plus minimum, maximum and mean for numbers.

Pay by wallet (x402) schema-infer

Example

Example answer
{
  "fields": [
    {
      "max": 30,
      "min": 25,
      "mean": 27.5,
      "name": "age",
      "type": "number",
      "unique": true,
      "nullable": false,
      "sample_values": [
        30,
        25
      ],
      "completeness_percent": 100
    },
    {
      "name": "city",
      "type": "string",
      "unique": true,
      "nullable": false,
      "sample_values": [
        "Stockholm",
        "Oslo"
      ],
      "completeness_percent": 100
    },
    {
      "name": "name",
      "type": "string",
      "unique": true,
      "nullable": false,
      "sample_values": [
        "Alice",
        "Bob"
      ],
      "completeness_percent": 100
    }
  ],
  "total_rows": 2,
  "total_fields": 3,
  "format_detected": "json"
}

Inputs

FieldTypeRequiredWhat it is
dataanyYesJSON array or CSV string

Output fields

How reliably each field appears in a successful answer.

FieldTypeAppears
fieldsarrayAlways (present in every successful answer)
total_rowsintegerAlways (present in every successful answer)
total_fieldsintegerAlways (present in every successful answer)
format_detectedstringAlways (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": "schema-infer",
    "inputs": {
      "data": [
        {
          "age": 30,
          "city": "Stockholm",
          "name": "Alice"
        },
        {
          "age": 25,
          "city": "Oslo",
          "name": "Bob"
        }
      ]
    },
    "max_price_cents": 5
  }'

Limitations

  • Samples can omit optional fields and rare types

    Infers schema from sample data — optional fields or rare value types may not appear in the inferred schema

    What to do instead: Provide a representative sample including edge cases and null values for more accurate schema inference