clean_data
Clean a messy spreadsheet or JSON export into typed, deduplicated records with a log of each change.
Use it when a spreadsheet or export needs cleaning or deduplicating before analysis or import. It finds the header row, works out each
column's type from the values (ids incl. barcodes/ISBN/IBAN check digits, emails, phones, dates, times,
durations, money, percents, quantities with units, ZIP and postal codes, states, countries, US street
addresses, coordinates, URLs, names, booleans), keeps leading zeros, reads European decimals, repairs
broken encodings and merges duplicate records. It flags what deserves a look without changing it:
disposable or role emails, phone numbers that can't exist, failed check digits. Returns rows, changes
(row, column, before, after, rule), review (each with a type: invalid, conflict, possible_duplicate (a group of records that look
like the same person or company, with a confidence, the evidence and the strongest pairs' likelihoods; never
merged), shared_email (records sharing an email whose names, birth dates, ID numbers or Jr./Sr. say different
people, kept apart), totals_row or note_row,
and the reason),
columns (with the evidence for each choice), quality (share of clean cells before and after),
clusters (likely typos), a JSON schema, a reusable recipe and stats, whose counts always add up to
the input rows. A file holding several tables (stacked, titled, or side by side) is split: the largest is
the main result and every other table comes back cleaned under other_tables. Price: $0.50 per 1,000
rows across all tables, minimum $0.01.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "clean_data"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | Public http(s) link to a CSV, TSV, XLSX or JSON file, up to 100 MB. Use this or content_base64. | |
| hints | No | Force a column's type, e.g. {"Joined": "date"}. Types: id, email, phone, date, datetime, time, duration, money, percent, number, quantity, zip, postcode, us_state, state, country, address, latitude, longitude, coordinates, url, name, boolean, text. | |
| sheet | No | Excel only: the sheet to clean. Default: the first sheet with data. | |
| table | No | When the file holds several tables, which one is the main result (1 = first). Default: the largest; the others are in `other_tables`. | |
| recipe | No | The `recipe` from an earlier run. Pass it to clean a new file with the same column types and rules. | |
| filename | No | File name with extension (e.g. customers.csv). Required with content_base64 so the format is known. | |
| required | No | Columns a row must have; rows missing one go to the review list. | |
| dedupe_on | No | Columns that identify a record; rows matching on them merge into one. Default: the email column, else the whole row. | |
| header_row | No | The file line holding the column names, if the automatic choice is wrong (1 = first line). | |
| phone_format | No | 'national' like (415) 555-0100, or 'e164' like +14155550100. | national |
| phone_region | No | Two-letter country for phone numbers written without a country code, e.g. US, GB, DE. | US |
| content_base64 | No | The file itself, base64-encoded, for small files you hold locally. Use this or url. | |
| fix_email_typos | No | Correct obvious typos in big mail providers (gmial.com -> gmail.com). Every fix is in the change log. | |
| min_duplicate_confidence | No | List look-alike records as possible duplicates from this likelihood (0-1). Default 0.5; 0.9 for only the near-certain ones; 1 means only the surest (99.5%). |