Elysia Tools Docs
EN
Language
ZHESPTRUFRDEEN
Back to site
Browse tools

Development

CSV Malformed Row Surgeon

Surgically repair malformed CSV rows one at a time: unescaped (stray) quotes, mixed delimiters (tab/semicolon/comma in the same file), BOM-prefixed headers, CRLF/CR line endings and trailing empty lines. The surgeon parses tolerantly, shows a row-level red/green diff of every change it made (before → after, with the repair reason tagged), lists the rows it accepted unchanged, and emits the cleaned CSV. Optional AI repair can review suspicious rows after the deterministic pass. It complements the CSV Validator (which only reports problems) by actually fixing the damaged rows.

html· HTML resultOpen tool

Quick start

Call this tool from your code in three languages.

cURL
curl -X POST 'https://api.elysiatools.com/en/api/tools/csv-malformed-row-surgeon' \
  -H 'Content-Type: application/json' \
  -d '{"csvInput":"id,name,note\r\n1,Ada,\"loves, commas\"\r\n2,Grace\" Hopper,unescaped quote\r\n3\tLinus\ttab row\r\n","delimiter":",","targetDelimiter":",","stripBom":true,"unescapeStrayQuotes":true,"quoteFields":true,"normalizeLineEndings":true,"dropEmptyLines":true,"trimCells":false,"detectMixedDelimiters":true,"useAiRepair":false,"outputCsv":true}'

© 2026 Elysia Tools. Developer documentation.

Back to siteBrowse tools

API reference

Send a POST request with your inputs as JSON. File parameters require a separate upload first.

Endpoint

HTTP
POST https://api.elysiatools.com/en/api/tools/csv-malformed-row-surgeon

Parameters

NameTypeRequiredDescription
csvInputtextareaYes—
delimiterselectNo—
targetDelimiterselectNo—
stripBomcheckboxNo—
unescapeStrayQuotescheckboxNo—
quoteFieldscheckboxNo—
normalizeLineEndingscheckboxNo—
dropEmptyLinescheckboxNo—
trimCellscheckboxNo—
detectMixedDelimiterscheckboxNo—
useAiRepaircheckboxNo—
outputCsvcheckboxNo—

Response format

HTML result

JSON
{
  "result": "<div>Processed HTML content</div>",
  "error": "Error message (optional)",
  "message": "Notification message (optional)",
  "metadata": {
    "key": "value"
  }
}

MCP integration

Add this tool to your Model Context Protocol server so AI agents can list and call it.

Server configuration

Add this block to your MCP client configuration:

mcp.json
{
  "mcpServers": {
    "elysiatools-csv-malformed-row-surgeon": {
      "name": "csv-malformed-row-surgeon",
      "description": "Surgically repair malformed CSV rows one at a time: unescaped (stray) quotes, mixed delimiters (tab/semicolon/comma in the same file), BOM-prefixed headers, CRLF/CR line endings and trailing empty lines. The surgeon parses tolerantly, shows a row-level red/green diff of every change it made (before → after, with the repair reason tagged), lists the rows it accepted unchanged, and emits the cleaned CSV. Optional AI repair can review suspicious rows after the deterministic pass. It complements the CSV Validator (which only reports problems) by actually fixing the damaged rows.",
      "baseUrl": "https://api.elysiatools.com/mcp/sse?toolId=csv-malformed-row-surgeon",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

List available tools

After connecting to the SSE endpoint, list the exposed tools:

tools/list
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/list"
}

Call this tool

Invoke the tool by its id, passing arguments built from its parameters:

tools/call
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "csv-malformed-row-surgeon",
    "arguments": {
  "csvInput": "id,name,note\r\n1,Ada,\"loves, commas\"\r\n2,Grace\" Hopper,unescaped quote\r\n3\tLinus\ttab row\r\n",
  "delimiter": ",",
  "targetDelimiter": ",",
  "stripBom": true,
  "unescapeStrayQuotes": true,
  "quoteFields": true,
  "normalizeLineEndings": true,
  "dropEmptyLines": true,
  "trimCells": false,
  "detectMixedDelimiters": true,
  "useAiRepair": false,
  "outputCsv": true
}
  }
}
Chain multiple tools in one session with a comma-separated toolId list, e.g. /mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp (max 20).

Questions or issues? Contact [email protected]

Browse tools
Open tool