Skip to main content
Glama

Dataset Cleaner & Exporter

clean_rows

Deduplicates, flattens and cleans a list of JSON rows in one call and returns spreadsheet-ready rows (or CSV text) plus a summary with exact counts: rows in, rows added by expansion, duplicates removed, rows dropped by maxItems, rows out, the final column list, per-column fill rates and warnings. Steps, in order: optionally explode one array field into one row per entry; flatten nested objects into columns (address.city becomes address_city); trim text; lowercase valid emails; reduce phone numbers to digits with any leading +; lowercase URL hosts and drop the trailing slash; optionally strip HTML and turn numeric or true/false text into numbers and booleans; blank text becomes null; keep, remove or rename columns; then remove duplicates (normalized by default, comparing the whole row unless dedupKeys is set) keeping the most complete row. Deterministic, no AI, nothing guessed. Use it on scraped leads, CRM exports or API results before loading them anywhere. There is a row limit per call (see list_capabilities); split bigger lists across several calls.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "rows": "<rows>"
    },
    "name": "clean_rows"
  }
}

Input Schema

NameRequiredDescriptionDefault
rowsYesThe rows to clean. Each row is a JSON object; keys may differ between rows and values may be nested.
flattenNoDefault true. Turn nested objects into flat columns. Arrays become one JSON-text cell.
maxItemsNoOptional cap: read at most this many rows and return at most this many. 0 (default) means no cap.
dedupKeysNoFields that identify a duplicate, for example ["Email"]. Empty compares the whole row. Use the final column names: flattened (Details_founded) and renamed. Exact and case-sensitive. Rows where every key is empty count as duplicates of each other.
dedupModeNoHow duplicates are found. normalized (default) ignores case and whitespace; exact needs identical values; fuzzy also merges near-duplicates (up to 1000 rows and 1000 characters of key text, so name a short field in dedupKeys); none keeps every row.
stripHtmlNoDefault false. Remove HTML tags and decode common entities in text.
cleanFieldsNoDefault true. Normalize emails, phone numbers and URLs, detected by field name or value shape.
coerceTypesNoDefault false. Turn "42" into 42 and "true" into true. Leading-zero values like "007" stay text.
emptyToNullNoDefault true. Blank text becomes null.
keepStrategyNoWhich duplicate survives: most_complete (default, fewest empty fields), first or last.
outputFormatNojson (default) returns rows; csv returns the same result as CSV text in "csv" instead.
columnsToKeepNoKeep only these columns (flattened names). Takes priority over columnsToRemove.
columnRenameMapNoRename columns after keep/remove, as ["oldName:newName"] or {"oldName":"newName"}, for example {"Details_founded":"founded"}.
columnsToRemoveNoDrop these columns (flattened names). Ignored if columnsToKeep is set.
dropEmptyFieldsNoDefault false. Remove null and empty fields from each row.
expandArrayFieldNoOptional. One top-level array field (for example "offers") to explode into one row per entry, repeating the other fields. Object entries become columns. The expanded total must stay within the row limit.
flattenSeparatorNoJoins nested key paths when flattening. Default "_".
similarityThresholdNoFuzzy mode only. 0.5 to 0.99, default 0.9. Higher is stricter.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / dedupMode / description
      Previous value: -"How duplicates are found. normalized (default) ignores case and whitespace; exact needs identical values; fuzzy also merges near-duplicates (up to 100 rows and 1000 characters of key text, so name a short field in dedupKeys); none keeps every row."New value: +"How duplicates are found. normalized (default) ignores case and whitespace; exact needs identical values; fuzzy also merges near-duplicates (up to 1000 rows and 1000 characters of key text, so name a short field in dedupKeys); none keeps every row."
  2. First observed

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and mostly does: it discloses the exact step order, that deduplication defaults to normalized comparison over the whole row, that the 'most complete' row survives, that the tool is deterministic and does no AI guessing, and that a row limit applies per call. It also states what the summary contains (counts in, expanded, deduped, dropped, out, column list, fill rates, warnings), which is behavior no schema field conveys.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose and output are front-loaded, and the long middle sentence is an ordered pipeline where each clause carries distinct information. The dense single-block paragraph makes it harder to scan than a bulleted step list, and a few clauses such as the phone/URL normalization details are more granular than a caller strictly needs.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an 18-parameter transformation tool with no output schema, the definition covers what an agent needs: the processing order that determines how parameters interact, the defaults that matter (normalized dedup, most_complete survivor), failure/limit expectations, and the shape of the return value including the summary fields.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is already 100%, so the baseline is 3; the description earns above that by describing cross-parameter behavior beyond individual fields — the pipeline order (explode, flatten, clean, keep/remove/rename, dedup), priority of columnsToKeep over columnsToRemove, and the note that dedupKeys must use final flattened/renamed column names. It does not restate defaults for most flags, which is fine since the schema does.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb set and resource ('Deduplicates, flattens and cleans a list of JSON rows') and immediately names the return artifact ('spreadsheet-ready rows (or CSV text) plus a summary with exact counts'). That is enough to distinguish it from the only sibling, list_capabilities, which is a capability-listing tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives concrete intake contexts — 'scraped leads, CRM exports or API results before loading them anywhere' — and an operational constraint: split lists larger than the per-call row limit across several calls (see list_capabilities). What is missing is any negative guidance, i.e. when not to use it or what to do instead for very large or already-clean data.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.