Reconcile two lists by ID, not by their totals

Matching totals do not prove two lists agree. In the example below, both sides add up to 150.00, yet one shared record has a different amount and each side holds a record the other lacks. The reconcile tool pairs rows by an exact ID, compares amounts in integer cents, and passes only when nothing is missing or changed.

reconcile matches records by a shared ID field. Matching records that have no shared ID isn't supported yet. Sets without one return a NO_SHARED_ID error.

Same total, three differences

This is the example built into the playground. The left list could be an agent's export and the right list the source system.

Input:

{
  "left": [
    { "id": "A", "amount": "100.00" },
    { "id": "B", "amount": "50.00" }
  ],
  "right": [
    { "id": "A", "amount": "90.00" },
    { "id": "C", "amount": "60.00" }
  ],
  "id_field": "id",
  "amount_field": "amount"
}

Result:

{
  "pass": false,
  "missing_left": ["C"],
  "missing_right": ["B"],
  "changed": [
    { "id": "A", "left": "100.00", "right": "90.00", "delta": "10.00" }
  ],
  "left_total": "150.00",
  "right_total": "150.00",
  "difference": "0.00"
}

The totals match and difference is 0.00, but the check fails. A total-only comparison would have passed this pair.

How to read the result

Field Meaning
pass true only when no ID is missing from either side and no shared ID has a different amount.
missing_left IDs that appear on the right but not on the left. Here, C.
missing_right IDs that appear on the left but not on the right. Here, B.
changed Shared IDs whose amounts differ. delta is left minus right.
left_total, right_total Each side's sum, added as integer cents.
difference left_total minus right_total. It is reported, but it does not decide pass.

A clean match

Row order does not matter. Here the right list is shuffled and every amount agrees:

{
  "left": [
    { "invoice": "INV-1001", "total": "1250.00" },
    { "invoice": "INV-1002", "total": "310.40" },
    { "invoice": "INV-1003", "total": "89.99" }
  ],
  "right": [
    { "invoice": "INV-1003", "total": "89.99" },
    { "invoice": "INV-1001", "total": "1250.00" },
    { "invoice": "INV-1002", "total": "310.40" }
  ],
  "id_field": "invoice",
  "amount_field": "total"
}
{
  "pass": true,
  "missing_left": [],
  "missing_right": [],
  "changed": [],
  "left_total": "1650.39",
  "right_total": "1650.39",
  "difference": "0.00"
}

id_field and amount_field name the keys to use, so your rows can keep their own field names.

Rules the tool applies

Each rule below applies to reconcile (and its hidden alias reconcile_records, deprecated with sunset 2026-12-26). The worked results below were captured on engine version 0.2.0 and show only the matching fields. On the live server (v0.4.0), responses also include a checks block and a receipt object.

IDs match exactly, including case. INV-1001 on the left and inv-1001 on the right are different records:

{
  "pass": false,
  "missing_left": ["inv-1001"],
  "missing_right": ["INV-1001"],
  "changed": [],
  "left_total": "1250.00",
  "right_total": "1250.00",
  "difference": "0.00"
}

There is no fuzzy matching. Normalize IDs before you call the tool if your systems format them differently. An integer ID and its string form match. Here, 101 matches "101":

{
  "left": [
    {
      "id": 101,
      "amount": "10.00"
    }
  ],
  "right": [
    {
      "id": "101",
      "amount": "10.00"
    }
  ],
  "id_field": "id",
  "amount_field": "amount"
}
{
  "pass": true,
  "missing_left": [],
  "missing_right": [],
  "changed": [],
  "left_total": "10.00",
  "right_total": "10.00",
  "difference": "0.00"
}

Duplicate IDs stop the call. If either side has the same ID twice, the pairing is ambiguous, so the tool returns an error instead of a result:

{
  "error": {
    "code": "DUPLICATE_ID",
    "path": "left[1].id",
    "got": "\"A\"",
    "expected": "nonblank string or integer (digits kept exactly) unique on the left side",
    "fix": "Remove the extra row or give it an unused ID on the left side. Both forms of \"A\" count as the same ID.",
    "example": "INV-123",
    "duplicate_ids": [
      "A"
    ]
  }
}

Every row needs the ID field. A row without it returns a MISSING_FIELD error with the path to the missing ID:

{
  "error": {
    "code": "MISSING_FIELD",
    "path": "left[0].id",
    "got": "missing",
    "expected": "nonblank string or integer (digits kept exactly)",
    "fix": "Supply the selected ID field on this row.",
    "example": "INV-123"
  }
}

reconcile matches records by a shared ID field. Matching records that have no shared ID isn't supported yet. Sets without one return a NO_SHARED_ID error.

Amounts can be decimal strings or numbers. Up to two decimal places are allowed. The number 100 and the string "100" both equal "100.00". Here is the result when one side sends 100 and the other sends "100.00":

{
  "pass": true,
  "missing_left": [],
  "missing_right": [],
  "changed": [],
  "left_total": "100.00",
  "right_total": "100.00",
  "difference": "0.00"
}

One currency. There is no currency field. Amounts on both sides are treated as the same currency, so convert first if they are not.

Size limits. Each side takes up to 1,000 rows, per the tool's input schema. The server rejects request bodies over 64 KB.

Check IDs and row counts first

Two-list matching rejects duplicates outright. To find out which IDs repeat, and which rows have no ID, run reconcile on one list with check_unique_ids first:

{
  "rows": [
    {
      "invoice": "INV-1001"
    },
    {
      "invoice": "INV-1002"
    },
    {
      "invoice": "INV-1001"
    },
    {
      "total": "5.00"
    }
  ],
  "id_field": "invoice",
  "check_unique_ids": true
}
{
  "pass": false,
  "checks": {
    "unique_ids": {
      "pass": false,
      "duplicate_ids": [
        "INV-1001"
      ],
      "missing_rows": [
        3
      ]
    }
  },
  "receipt": {
    "version": "0.4.0",
    "checked_at": "2026-11-26T14:18:02.630Z",
    "vantage": "cloudflare:IAD",
    "input_sha256": "cf6d57f62123d1fdad18b609a37e89606fb67fa052ec6cf811757e571fa08bc8"
  }
}

missing_rows lists zero-based row positions. To confirm a list has the length you expect, pass expected_row_count:

{
  "rows": [
    {
      "invoice": "INV-1001"
    },
    {
      "invoice": "INV-1002"
    },
    {
      "invoice": "INV-1003"
    }
  ],
  "expected_row_count": 3
}
{
  "pass": true,
  "checks": {
    "row_count": {
      "pass": true,
      "observed": 3,
      "difference": 0
    }
  },
  "receipt": {
    "version": "0.4.0",
    "checked_at": "2026-11-26T14:18:03.907Z",
    "vantage": "cloudflare:IAD",
    "input_sha256": "0f4f88d5846def8cece716dad72a94367b9e6d1aaae1e4f26eb979c221e7af3e"
  }
}

The row count covers only the rows you send. It can't tell you whether the source had more.

If a list mixes integers and strings, the duplicate-ID check reports the rows whose type differs from the first valid ID. In this example the two forms count as a duplicate:

{
  "rows": [
    {
      "id": 101
    },
    {
      "id": "101"
    }
  ],
  "id_field": "id",
  "check_unique_ids": true
}
{
  "pass": false,
  "checks": {
    "unique_ids": {
      "pass": false,
      "duplicate_ids": [
        "101"
      ],
      "missing_rows": [],
      "warnings": {
        "mixed_types": [
          1
        ]
      }
    }
  },
  "receipt": {
    "version": "0.4.0",
    "checked_at": "2026-11-26T14:18:05.040Z",
    "vantage": "cloudflare:IAD",
    "input_sha256": "5c674d9684bb7445a03a594394284c4b57098ef330b769821d52ac965d0890d4"
  }
}

These three results were captured from the live server (v0.4.0) on 2026-11-26.

To run all three as a single pass or fail check, see Check an agent's file before you accept it.

Call it over MCP

The server needs no API key during the beta and keeps no session, so one POST is enough:

curl -sS https://mcp.agenttoolyard.com/mcp \
  -H 'content-type: application/json' \
  -H 'accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"reconcile","arguments":{"left":[{"id":"A","amount":"100.00"},{"id":"B","amount":"50.00"}],"right":[{"id":"A","amount":"90.00"},{"id":"C","amount":"60.00"}],"id_field":"id","amount_field":"amount"}}}'

The tool's result comes back as JSON text inside result.content[0].text. For protocol details and other ways to call the server, see the MCP docs. To add the server to Claude, Cursor, VS Code and other clients, see Add AgentToolyard to an MCP client. You can also run the same example in the playground without sending anything to the server.

FAQ

Does reconcile match similar IDs?

No. Matching is exact and case-sensitive. INV-1001 and inv-1001 are reported as two unmatched records.

What happens if an ID appears twice?

The call returns a DUPLICATE_ID error with the duplicate IDs and the path to the first duplicate. Run reconcile on each side with check_unique_ids to find the repeats.

Can I reconcile amounts in two currencies?

Not directly. The tool has no currency field and treats every amount as one currency. Convert the amounts before you compare them.

Why did the check fail when the totals match?

Totals hide offsetting errors. A missing record on one side and an extra record on the other can cancel out, as in the first example. The check passes only when every ID pairs up with the same amount.

Does AgentToolyard keep the rows I send?

According to the privacy policy, the MCP server is stateless and doesn't keep tool arguments after it sends the response. The playground runs in your browser. Don't send live customer files or credentials during the beta.