CSV reconcile

csv-reconcile · version 1.0.0 · CSV & tables · free, no key needed

Reconcile two CSV documents by key columns, reporting full population totals and bounded samples for added, removed, changed, invalid-key, and ambiguous rows.

Use when you need to: csv reconcile · reconcile csv · csv reconciliation.

Supported

Not supported

Behavior

Input

Output

Limits

Example

Request input:

{
  "left": "id,name,city\n1,Ada,London\n2,Lin,Paris\n3,Zoe,Berlin\n4,Sam,Bristol\n5,Duplicate,CityA\n5,Duplicate,CityB\n,InvalidKey,NoId\n",
  "right": "city,name,id\nLondon,Ada,1\nRome,Lin,2\nOslo,Bob,6\nBristol,Sam,4\nCityA,Duplicate,5\nCityB,Duplicate,5\nNewCity,ValidKey,\n",
  "keys": [
    "id"
  ]
}

Response:

{
  "result": {
    "totals": {
      "left_rows": 7,
      "right_rows": 7,
      "invalid_left": 1,
      "invalid_right": 1,
      "ambiguous_left": 2,
      "ambiguous_right": 2,
      "ambiguous_keys": 1,
      "added": 1,
      "removed": 1,
      "changed": 1,
      "unchanged": 2
    },
    "added": {
      "total": 1,
      "samples": [
        {
          "row": 3,
          "key": [
            "6"
          ],
          "values": {
            "city": "Oslo",
            "name": "Bob",
            "id": "6"
          }
        }
      ],
      "truncated": false
    },
    "removed": {
      "total": 1,
      "samples": [
        {
          "row": 3,
          "key": [
            "3"
          ],
          "values": {
            "id": "3",
            "name": "Zoe",
            "city": "Berlin"
          }
        }
      ],
      "truncated": false
    },
    "changed": {
      "total": 1,
      "samples": [
        {
          "key": [
            "2"
          ],
          "left_row": 2,
          "right_row": 2,
          "changed_columns": [
            "city"
          ],
          "before": {
            "city": "Paris"
          },
          "after": {
            "city": "Rome"
          }
        }
      ],
      "truncated": false
    },
    "invalid_left": {
      "total": 1,
      "samples": [
        {
          "row": 7,
          "key": [
            ""
          ],
          "values": {
            "id": "",
            "name": "InvalidKey",
            "city": "NoId"
          }
        }
      ],
      "truncated": false
    },
    "invalid_right": {
      "total": 1,
      "samples": [
        {
          "row": 7,
          "key": [
            ""
          ],
          "values": {
            "city": "NewCity",
            "name": "ValidKey",
            "id": ""
          }
        }
      ],
      "truncated": false
    },
    "ambiguous_keys": {
      "total": 1,
      "samples": [
        {
          "key": [
            "5"
          ],
          "tuple": [
            "5"
          ],
          "left_count": 2,
          "right_count": 2,
          "left_rows": [
            5,
            6
          ],
          "right_rows": [
            5,
            6
          ],
          "left_truncated": false,
          "right_truncated": false
        }
      ],
      "truncated": false
    }
  }
}

How to call it

MCP

Connect https://computefirst.net/mcp (setup), then call execute with:

{
  "id": "csv-reconcile",
  "version": "1.0.0",
  "input": {
    "left": "id,name,city\n1,Ada,London\n2,Lin,Paris\n3,Zoe,Berlin\n4,Sam,Bristol\n5,Duplicate,CityA\n5,Duplicate,CityB\n,InvalidKey,NoId\n",
    "right": "city,name,id\nLondon,Ada,1\nRome,Lin,2\nOslo,Bob,6\nBristol,Sam,4\nCityA,Duplicate,5\nCityB,Duplicate,5\nNewCity,ValidKey,\n",
    "keys": [
      "id"
    ]
  }
}

HTTP (no key)

curl -X POST https://computefirst.net/v1/tools/csv-reconcile/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"left":"id,name,city\n1,Ada,London\n2,Lin,Paris\n3,Zoe,Berlin\n4,Sam,Bristol\n5,Duplicate,CityA\n5,Duplicate,CityB\n,InvalidKey,NoId\n","right":"city,name,id\nLondon,Ada,1\nRome,Lin,2\nOslo,Bob,6\nBristol,Sam,4\nCityA,Duplicate,5\nCityB,Duplicate,5\nNewCity,ValidKey,\n","keys":["id"]}'

The machine-readable contract is at /v1/tools/csv-reconcile/versions/1.0.0.

CLI

node cli.mjs run csv-reconcile 1.0.0 --input input.json --base-url https://computefirst.net

Get the client at /clients/cli/.