CSV dialect parse
csv-dialect-parse · version 1.0.0 · CSV & tables · free, no key needed
Parse CSV with an explicit dialect into string rows, keeping leading zeros and embedded breaks.
Use when you need to: parse csv with an explicit dialect · read rfc 4180 text into string cells · parse pipe quoted csv fields.
Decide before calling
Read the versioned contract and the supported scope below. Reuse csv-dialect-parse@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.
Explain the choice
"I can use csv-dialect-parse@1.0.0 for parse csv with an explicit dialect. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."
Supported
- parse csv with an explicit dialect
- read rfc 4180 text into string cells
- parse pipe quoted csv fields
- split csv on a declared delimiter
- parse doubled quotes inside csv fields
- apply a record separator to csv text
- פענוח שורות לפי ניב מוצהר
Not supported
- infer column types or strip leading zeros
- trim spaces or skip comment lines
- read a file path or a network url
Behavior
- The caller supplies delimiter (one code point), quote (" or | or none), escape (double, backslash, or none), record_separator (LF, CRLF, or CR), and header (present or absent). Any other combination is unsupported_input.
- Every cell is a string. There is no trim, no type coercion, and no Unicode normalization. A trailing record separator does not add a row. A blank line is one empty field, because an empty field is allowed.
- Doubled quotes inside a quoted field are one quote when escape is double. A backslash escapes the next code point. A quote is legal only at the start of a field.
- header present splits the first record into header and requires equal widths, non-empty names, and no exact duplicate. header absent keeps ragged rows and sets header to null. Names stay in an array, so __proto__ is an ordinary header string.
- A one-field record whose text is a quoted empty field ("") is the row [[""]]. The same row is what format writes for a single empty field.
- Limits are checked before a full result is returned. Over-limit input is limit_exceeded even when the text is also malformed. The same input always yields the same object.
Input
csv(string, required): min length 1; max length 1024dialect(object, required)
Output
header(array or null, required): min items 1; max items 8rows(array of array of string, required): max items 64; each min items 1; each max items 8; each each max length 256ragged(boolean, required)record_count(integer, required): min 1; max 64dialect(object, required)
Limits
- max input bytes: 1024
- max records: 64
- max fields: 8
- max field bytes: 256
- max output bytes: 4096
- max depth: 8
Example
Request input:
{
"csv": "aaa,bbb,ccc\r\nzzz,yyy,xxx\r\n",
"dialect": {
"delimiter": ",",
"quote": "\"",
"escape": "double",
"record_separator": "\r\n",
"header": "absent"
}
}
Response:
{
"result": {
"header": null,
"rows": [
[
"aaa",
"bbb",
"ccc"
],
[
"zzz",
"yyy",
"xxx"
]
],
"ragged": false,
"record_count": 2,
"dialect": {
"delimiter": ",",
"quote": "\"",
"escape": "double",
"record_separator": "\r\n",
"header": "absent"
}
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "csv-dialect-parse",
"version": "1.0.0",
"input": {
"csv": "aaa,bbb,ccc\r\nzzz,yyy,xxx\r\n",
"dialect": {
"delimiter": ",",
"quote": "\"",
"escape": "double",
"record_separator": "\r\n",
"header": "absent"
}
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/csv-dialect-parse/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"csv":"aaa,bbb,ccc\r\nzzz,yyy,xxx\r\n","dialect":{"delimiter":",","quote":"\"","escape":"double","record_separator":"\r\n","header":"absent"}}'
The machine-readable contract is at /v1/tools/csv-dialect-parse/versions/1.0.0.
CLI
node cli.mjs run csv-dialect-parse 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- CSV dialect format: Format string rows as CSV for an explicit dialect, quoting a one-field empty record when it can.
- CSV dialect detect: Detect delimiter, quote, escape, record separator, and header for one rectangular CSV sample.
- CSV split column: Split one CSV column on an exact separator into uniquely named columns.
- CSV merge columns: Join named CSV columns with an exact separator into one column.
- CSV fill defaults: Replace empty cells in named CSV columns with exact default strings.
- CSV to JSON: Convert a complete CSV document into an array of string-valued objects.