Skip to main content

Match conditions

Every Source adapter converts its response into:

  • a result count;
  • the first candidate record, represented as a flat object for field matching.

All conditions in match must pass. With no conditions, the check requires at least one result.

Field conditions

A field condition names a Source result field and an operator:

match:
- column: status
op: eq
value: active

column is used for both SQL columns and JSON object fields.

Comparison targets

Compare a field to one of four target types.

Trusted caller context:

- column: customer_id
ctx: customer_id

A literal:

- column: status
value: active

Another proposed tool argument:

- column: balance
op: gte
arg: amount

Exact decimal equality for a money field must be declared explicitly:

- column: amount_due
op: eq
arg: amount
type: decimal

type: decimal is valid with eq and ne. Both operands are parsed by the same exact, finite Decimal path used by ActionRail policies. It treats 1250, 1250.0, and "1250.00" as the same number without rounding, while invalid, Boolean, NaN, and infinite inputs fail closed. Do not apply this type to identifiers, account numbers, or scopes where formatting is meaningful.

The current time plus an optional offset:

- column: delivered_at
op: gte
now: -30d

Time offsets support s, m, h, d, and w, such as -15m, +1h, or -30d. An empty value means the current instant. Source values may be ISO-8601 timestamps or epoch seconds/milliseconds.

Operators

OperatorMeaningComparison behavior
eqequalString equality by default; exact numeric equality with type: decimal.
nenot equalString inequality by default; exact numeric inequality with type: decimal.
gtgreater thanNumeric conversion.
gtegreater than or equalNumeric conversion.
ltless thanNumeric conversion.
lteless than or equalNumeric conversion.
containscontains substringString containment.
inis one ofExpected value is a comma-separated string.
setis setActual value is neither null nor an empty string. No target.
emptyis emptyActual value is null or an empty string. No target.

When numeric conversion fails for an ordered comparison, the condition fails.

Result-count conditions

Count conditions work across SQL rows, JSON lists, MCP results, and HTTP responses:

match:
- rows: eq
value: 0

Common patterns:

# Required existence
- rows: gte
value: 1

# Blocklist or idempotency check: no matching result may exist
- rows: eq
value: 0

# Velocity threshold
- rows: lte
value: 3

Count conditions support eq, ne, gt, gte, lt, and lte.

Lists and multiple rows

Count conditions see the full number of returned results. Field conditions inspect only the first returned record.

Make ordering explicit when the identity of the first SQL row or JSON list item matters. Prefer a query or Source endpoint that returns one unambiguous candidate record for ownership and state checks.

Legacy shapes

The runtime still accepts must_match as a single field condition and expect: absent as “row count equals zero.” New configuration should use the match list and explicit row-count conditions.