CSV dialect format
csv-dialect-format · version 1.0.0 · CSV & tables · free, no key needed
Format string rows as CSV for an explicit dialect, quoting a one-field empty record when it can.
Use when you need to: format string rows with an explicit csv dialect · write rfc 4180 quoted csv fields · serialize string cells with a chosen delimiter.
Decide before calling
Read the versioned contract and the supported scope below. Reuse csv-dialect-format@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-format@1.0.0 for format string rows with an explicit csv 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
- format string rows with an explicit csv dialect
- write rfc 4180 quoted csv fields
- serialize string cells with a chosen delimiter
- emit a quoted empty csv field
- format quote-none csv or reject it
- render csv text from string records
- כתיבת שורות לטקסט מופרד
Not supported
- write an excel workbook
- omit the final record separator
- emit an unquoted one-field empty record
Behavior
- Every record, including the last, ends with the dialect record separator. quoting is minimal, all, or none. minimal quotes a field that contains the delimiter, the quote, CR, or LF. all quotes every field. none never quotes.
- A single empty field is written as a quoted empty field plus the separator, for example "" followed by LF. That text parses back to [[""]]. When quote is none or quoting is none, that record is unsupported_input with reason empty_field_needs_quote. Two empty fields stay a bare comma.
- escape double repeats the quote inside quotes. escape backslash prefixes a backslash to the delimiter, breaks, the quote, and itself when those characters must be escaped. A field that still cannot be represented is unsupported_input, not a best-effort line.
- header present writes the header array first and requires data rows of that width. Duplicate or empty header names are invalid_input. header absent rejects a header array. Cells stay strings: no trim and no Unicode normalization.
- Dialect key order is delimiter, quote, escape, record_separator, header. Records and fields keep input order. The same input always yields the same csv string.
Input
dialect(object, required)quoting(one of "minimal", "all", "none", required)header(array of string, optional): min items 1; max items 8; each min length 1; each max length 256rows(array of array of string, required): max items 64; each min items 1; each max items 8; each each max length 256
Output
csv(string, required): min length 1; max length 1024
Limits
- max input bytes: 4096
- max records: 64
- max fields: 8
- max field bytes: 256
- max csv bytes: 1024
- max output bytes: 4096
- max depth: 8
Example
Request input:
{
"dialect": {
"delimiter": ",",
"quote": "\"",
"escape": "double",
"record_separator": "\r\n",
"header": "absent"
},
"quoting": "minimal",
"rows": [
[
"aaa",
"bbb",
"ccc"
],
[
"zzz",
"yyy",
"xxx"
]
]
}
Response:
{
"result": {
"csv": "aaa,bbb,ccc\r\nzzz,yyy,xxx\r\n"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "csv-dialect-format",
"version": "1.0.0",
"input": {
"dialect": {
"delimiter": ",",
"quote": "\"",
"escape": "double",
"record_separator": "\r\n",
"header": "absent"
},
"quoting": "minimal",
"rows": [
[
"aaa",
"bbb",
"ccc"
],
[
"zzz",
"yyy",
"xxx"
]
]
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/csv-dialect-format/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"dialect":{"delimiter":",","quote":"\"","escape":"double","record_separator":"\r\n","header":"absent"},"quoting":"minimal","rows":[["aaa","bbb","ccc"],["zzz","yyy","xxx"]]}'
The machine-readable contract is at /v1/tools/csv-dialect-format/versions/1.0.0.
CLI
node cli.mjs run csv-dialect-format 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- CSV dialect parse: Parse CSV with an explicit dialect into string rows, keeping leading zeros and embedded breaks.
- CSV dialect detect: Detect delimiter, quote, escape, record separator, and header for one rectangular CSV sample.
- CSV fill defaults: Replace empty cells in named CSV columns with exact default strings.
- CSV anti join: Keep left CSV rows whose exact key tuples do not appear in the right document.
- CSV concat: Concatenate CSV documents that share identical headers, preserving document and row order.
- CSV filter empty: Keep or drop CSV rows whose named column is the empty string.