Skip to main content
Glama

Data Cleaning & Validation for AI Agents

Data Cleaning & Validation for AI Agents — Saifs AI

data_cleaning
Read-only

Clean and validate a tabular export deterministically, with a change log. Inputs: rows (records, or a list of lists with the header row first; ERP / CRM headers as they are), optional rules ('amount = qty * price', 'due_date >= invoice_date', 'fd(pincode -> city)', 'status in (...)'), job (one of clean_dataset, map_columns, standardise_values, profile_data, infer_patterns, check_digits, validate_rules, fix_typos_units, fix_errors, discover_rules, fill_missing, flag_outliers, relationship_outliers, find_duplicates, compare_loads, quality_score, change_log), target_schema, field_weights, cleaning_profile (from an earlier run), history, confirmed_fixes + reviewed_rows (the user's corrections, to learn from), entity_key / source_field (several sources). Returns decision cards first, an agent-ready score before / after, column mapping, clean rows, the change log (old -> new, step, rule), quarantined rows with candidate fixes, missing-value report with ranges, outliers, Benford test, duplicate groups, check-digit failures, rules found in the data, values that do not fit their row, source reliability, what was learned, drift vs the last load, and an updated cleaning_profile. Never guesses an ambiguous fix; refuses imputation above 40% missing; under 30 rows profiles and validates only. Not for joining tables, looking data up outside the file, or deleting records. Files over 20,000 rows: data_cleaning_get_engine.

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": "data_cleaning"
  }
}

Input Schema

NameRequiredDescriptionDefault
jobNoWhich part to run; clean_dataset runs everything.clean_dataset
rowsNoThe data: records, or a list of lists with the header row first. Headers and values as exported (Party Name, Inv Amt, ₹1,25,000.00, 12-Jan-2025 ...).
seedNo
rulesNoBusiness rules, e.g. 'amount = qty * price', 'due_date >= invoice_date', 'if country = "IN" then not_null(gstin)', 'fd(pincode -> city)', 'unique(invoice_no)', 'status in ("open", "paid")'. Use the standard field names (see column_mapping).
stepsNoAdvanced: explicit step list (overrides job).
localeNoCountry for phones and ambiguous dates.IN
headersNoHeaders only (job map_columns without data).
historyNoEarlier clean rows (e.g. last months' invoice lines): usual ranges, and each item's usual quantity / amount, so more unit slips are settled instead of quarantined.
max_logNo
fix_caseNo
outlier_zNo
relationsNoRegressions to test, e.g. 'amount ~ qty * price'.
date_orderNo
entity_keyNoColumn naming the thing several sources report (e.g. flight); found automatically when omitted.
max_listedNo
return_rowsNo
source_fieldNoColumn naming the source / feed / site (found automatically when named like source, src, provider).
abs_toleranceNo
column_groupsNoField groups for the multivariate outlier test.
field_weightsNo{field: weight}: higher = more trusted, changed last by repairs.
impute_methodNoauto
rel_toleranceNo
reviewed_rowsNoRows the user checked: every value not in confirmed_fixes is correct.
target_schemaNoYour own fields: {field: {type, synonyms: [...]}}.
duplicate_keysNoFields that identify a record (else chosen automatically).
fd_min_supportNo
confirmed_fixesNoThe user's corrections: row (0 = first data row), field or header, the correct value. Applied, and used to learn fixes for similar errors.
learn_thresholdNoProbability a learned fix needs before it is applied.
cleaning_profileNocleaning_profile from an earlier run (confirmed mapping, rules, baselines for drift).
sensitive_fieldsNoExtra personal fields to hide from the profile.
fd_min_confidenceNo
mapping_thresholdNo
max_change_fieldsNo
max_rows_returnedNo
check_digit_fieldsNo{field: gstin | gtin | luhn | isbn | iban}.
max_missing_imputeNo
duplicate_thresholdNo
log_standardisationNo
extra_missing_tokensNo
apply_discovered_rulesNoAlso repair with rules found in the data (else only suggested).

Output Schema

NameRequiredDescriptionDefault
alertsNo
statusYes1 = processed, 0 = refused (see decisions)
benfordNo
messageNo
profileNo
sourcesNo
learningNo
metadataYes
outliersNo
decisionsYesPlain-language cards, priority order. Relay these first.
row_flagsNo
change_logNo
clean_rowsNo
quarantineNo
assumptionsNo
rule_errorsNo
drift_reportNo
rule_resultsNo
quality_scoreNo
suspect_cellsNo
change_summaryNo
column_mappingNo
fd_suggestionsNo
missing_reportNo
clean_row_indexNo
cleaning_profileNo
discovered_rulesNo
duplicate_groupsNo
rule_suggestionsNo
pattern_exceptionsNo
data_quality_reportNo
check_digit_failuresNo
discovered_row_rulesNo
relationship_outliersNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already mark this read-only and closed-world, and the description adds real behavioral commitments beyond them: it never guesses ambiguous fixes, refuses imputation above 40% missing, degrades to profile-only under 30 rows, and presents decision cards before results. These are exactly the traits an agent needs to trust and orchestrate the call.

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

Conciseness3/5

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

Purpose and inputs are front-loaded, but the middle is a long comma-spliced enumeration of every return value (decision cards, score, mapping, change log, quarantined rows, Benford test, drift, and more) that largely duplicates the output schema. That run-on list inflates length without adding much selection value.

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

Completeness4/5

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

For a 40-parameter, multi-job tool the definition covers the decision-relevant surface: what it does, what to pass, what it refuses to do, and when to switch to the sibling. Return-shape detail is arguably over-covered since an output schema exists, but nothing an agent needs to call it correctly appears to be missing.

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?

With 40 parameters and only 53% schema description coverage, the description compensates for the most consequential ones: it explains the two accepted shapes of rows, gives concrete rule syntax examples, and clarifies target_schema, field_weights, cleaning_profile, history, confirmed_fixes plus reviewed_rows, and entity_key/source_field. Many of the remaining tuning knobs (tolerances, thresholds, max_log) are left to the schema, so it is strong but not exhaustive.

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?

Opens with a specific verb pair and resource: "Clean and validate a tabular export deterministically, with a change log." It goes on to bound the scope (tabular export, deterministic) and clearly separates itself from the sibling by noting files over 20,000 rows belong to data_cleaning_get_engine.

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

Usage Guidelines5/5

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

Explicit exclusions are given ("Not for joining tables, looking data up outside the file, or deleting records") along with the size-based routing to data_cleaning_get_engine and a behavioral guard for tiny inputs ("under 30 rows profiles and validates only"). The job enum plus the note that clean_dataset runs everything tells an agent which mode to pick.

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.