Tools for agents: Lossless string-record CSV exporter

Export exact string-valued records to CSV with explicit columns, complete quoting and no silent field loss.

Connect with MCP

{
  "mcpServers": {
    "super-agent-tools": {
      "url": "https://app.getsupers.com/sites/agent-json-csv/mcp"
    }
  }
}
Streamable HTTP · No API key · Stateless

Use this URL in any client supporting remote Streamable HTTP MCP. Calls return structured JSON; inputs are processed without persistence.

Call export_csv_records

Supply a nonempty ordered list of unique header strings; empty or whitespace-only headers fail. Every record must have exactly those fields and every cell must already be a string. Numbers, booleans, null, arrays and objects are rejected rather than coerced. Header case and whitespace, cell spelling, leading zeros, embedded CR/LF and empty strings are preserved. All headers and cells are double-quoted, with internal quotes doubled. Records use CRLF separators, including a final separator. Delimiter may be comma, semicolon, tab or pipe. Output is UTF-8 without a BOM; utf8_bytes and sha256 describe csv_text encoded exactly that way. Zero records produce a header-only CSV. Quoting preserves text syntax but does not force spreadsheet apps to treat formulas or numeric-looking cells as text; no formula prefixing or other content changes occur. Unpaired surrogates fail. This exports data, not a spreadsheet workbook or uploaded file, and persists nothing.

Input and output schemas
{
  "name": "export_csv_records",
  "title": "Lossless string-record CSV exporter",
  "description": "Write string-valued records to CSV using an explicit ordered header. Reject missing or extra fields and return exact UTF-8 byte size and checksum.",
  "inputSchema": {
    "properties": {
      "headers": {
        "items": {
          "type": "string"
        },
        "title": "Headers",
        "type": "array"
      },
      "records": {
        "items": {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object"
        },
        "title": "Records",
        "type": "array"
      },
      "delimiter": {
        "default": ",",
        "enum": [
          ",",
          ";",
          "\t",
          "|"
        ],
        "title": "Delimiter",
        "type": "string"
      }
    },
    "required": [
      "headers",
      "records"
    ],
    "title": "export_csv_recordsArguments",
    "type": "object"
  },
  "outputSchema": {
    "additionalProperties": true,
    "title": "export_csv_recordsDictOutput",
    "type": "object"
  },
  "icons": null,
  "annotations": {
    "title": null,
    "readOnlyHint": true,
    "destructiveHint": false,
    "idempotentHint": true,
    "openWorldHint": false
  },
  "meta": null,
  "execution": null
}

Run the example to see the actual result.

HTTP alternative

POST https://app.getsupers.com/sites/agent-json-csv/call
Content-Type: application/json

{
  "headers": [
    "id",
    "note",
    "amount"
  ],
  "records": [
    {
      "id": "001",
      "note": "hello, agent",
      "amount": "12.50"
    },
    {
      "id": "002",
      "note": "two\nlines",
      "amount": ""
    }
  ],
  "delimiter": ","
}

The HTTP and MCP interfaces execute the same implementation. Validation errors are returned explicitly. See the tool notes above for its supported inputs and behavior.

Complete quoting preserves exact strings and record boundaries

Read the explanation

The saved CSV example has three ordered headers and two records. Each record must contain exactly those three fields, giving six data cells and three header cells. At forty pixels per cell the data count bar is two hundred forty, header count one hundred twenty and combined nine cells three hundred sixty. Values must already be strings: leading zero identifiers and an empty amount remain text, while numbers, null or extra fields fail the documented contract. This explains the saved API schema without executing its backend. Every header and cell is quoted, and an internal quote becomes two quotes. The embedded comma in hello comma agent stays inside one cell. The second note contains one embedded linefeed inside its quoted field. Three record separators use carriage return plus linefeed, including the final separator. Thus this example contains four linefeed characters but only three CSV records including the header. At sixty pixels per count three record boundaries measure one hundred eighty and four linefeeds two hundred forty. Counting physical lines alone cannot identify logical CSV rows. Serializing the shown fixture with all quoting and final carriage return linefeed gives seventy four UTF eight bytes because its characters are ASCII. At four pixels per byte the bar measures two hundred ninety six. With no data records the quoted header alone gives twenty two bytes. SHA two fifty six describes the exact bytes, not a spreadsheet interpretation. Quoting does not prevent formula evaluation or force numeric looking cells to remain text in spreadsheet software. The saved shared app script is absent offline, so local textarea editing can be preserved but actual HTTP or MCP export and returned checksum are not verified here.

Lossless CSV Record Serialization Mechanism

How does this tool guarantee lossless serialization from structured records to CSV without silent coercion or schema mismatch?

The tool implements strict validation and formatting by requiring pre-defined headers, ensuring every cell is explicitly a string, escaping quotes via RFC 4180 rules, and verifying payload integrity with UTF-8 byte counts and SHA-256 hashes.

The tool does not coerce non-string values like integers, floats, booleans, or null; passing non-string data or mismatched keys raises an error. It also does not prefix or sanitize cells that begin with formula characters ('=', '+', '-', '@'), meaning spreadsheet applications may still evaluate them upon import.

Try a worked example

Click 'Run tool' with the default payload containing two records. The result replaces the placeholder text with a JSON dictionary containing 'csv_text' formatted with quoted cells and CRLF line terminators, 'column_count': 3, 'row_count': 2, 'utf8_bytes', and a matching 'sha256' hex digest.

RFC 4180 Compliance and Quoting

RFC 4180 specifies that CSV records are separated by CRLF line breaks and that fields containing commas, line breaks, or double quotes must be enclosed in double quotes, with internal double quotes escaped by pairing them. RFC 4180: Common Format and MIME Type for Comma-Separated Values (CSV) Files

This tool applies universal quoting (csv.QUOTE_ALL) to every header and cell value, ensuring that leading zeros, whitespace, and embedded line breaks remain syntactically unambiguous across all delimiters.

Integrity and Formula Execution Scope

The implementation computes exact UTF-8 byte size and a SHA-256 hash of the serialized CSV text to provide deterministic transport verification across agent pipelines.

Standard CSV syntax does not prevent downstream spreadsheet software from interpreting formulas. The tool serializes text verbatim without altering initial characters, leaving spreadsheet formula injection defense to the consuming application. RFC 4180: Common Format and MIME Type for Comma-Separated Values (CSV) Files

Sources and further reading