Development
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.
Call this tool from your code in three languages.
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}'Send a POST request with your inputs as JSON. File parameters require a separate upload first.
POST https://api.elysiatools.com/en/api/tools/csv-malformed-row-surgeon| Name | Type | Required | Description |
|---|---|---|---|
| csvInput | textarea | Yes | — |
| delimiter | select | No | — |
| targetDelimiter | select | No | — |
| stripBom | checkbox | No | — |
| unescapeStrayQuotes | checkbox | No | — |
| quoteFields | checkbox | No | — |
| normalizeLineEndings | checkbox | No | — |
| dropEmptyLines | checkbox | No | — |
| trimCells | checkbox | No | — |
| detectMixedDelimiters | checkbox | No | — |
| useAiRepair | checkbox | No | — |
| outputCsv | checkbox | No | — |
HTML result
{
"result": "<div>Processed HTML content</div>",
"error": "Error message (optional)",
"message": "Notification message (optional)",
"metadata": {
"key": "value"
}
}Add this tool to your Model Context Protocol server so AI agents can list and call it.
Add this block to your MCP client configuration:
{
"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"
}
}
}After connecting to the SSE endpoint, list the exposed tools:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}Invoke the tool by its id, passing arguments built from its parameters:
{
"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
}
}
}Questions or issues? Contact [email protected]