# CSV filter pattern literal

`csv-filter-pattern-literal` · version 1.0.0 · CSV & tables · free, no key needed

Filter ASCII CSV with literal contains/starts-with; requires CRLF records, rejects LF-only and non-ASCII input.

**Use when you need to: filter CSV rows containing text · keep records starting with a prefix · find a literal substring in a CSV column.**

## Decide before calling

Read the [versioned contract](/v1/tools/csv-filter-pattern-literal/versions/1.0.0) and the supported scope below. Reuse `csv-filter-pattern-literal@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-filter-pattern-literal@1.0.0` for filter CSV rows containing text. 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

- filter CSV rows containing text
- keep records starting with a prefix
- find a literal substring in a CSV column
- select comma separated rows by prefix
- filter table fields without regex
- match literal text in CSV data

## Not supported

- regular expressions or glob patterns
- case folding
- Unicode normalization

## Behavior

- The first RFC 4180 record is a unique, non-empty header and is always retained.
- Matching is literal, case-sensitive UTF-16 startsWith or includes; metacharacters have no special meaning.

## Input

- `csv` (string, required): min length 1; max length 16384
- `column` (string, required): min length 1; max length 256
- `operator` (one of "contains", "starts-with", required)
- `literal` (string, required): max length 16384

## Output

- `csv` (string, required): max length 32768
- `rows_in` (integer, required): min 0; max 255
- `rows_out` (integer, required): min 0; max 255
- `standard_version` (constant "RFC 4180 (October 2005)", required)

## Limits

- max input bytes: 16384
- max rows: 256
- max columns: 32
- max iterations: 16384
- max output bytes: 32768

## Example

Request input:

```json
{
  "csv": "id,name\r\n1,Ada Lovelace\r\n2,Grace Hopper",
  "column": "name",
  "operator": "contains",
  "literal": "Love"
}
```

Response:

```json
{
  "result": {
    "csv": "id,name\r\n1,Ada Lovelace",
    "rows_in": 2,
    "rows_out": 1,
    "standard_version": "RFC 4180 (October 2005)"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "csv-filter-pattern-literal",
  "version": "1.0.0",
  "input": {
    "csv": "id,name\r\n1,Ada Lovelace\r\n2,Grace Hopper",
    "column": "name",
    "operator": "contains",
    "literal": "Love"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/csv-filter-pattern-literal/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"csv":"id,name\r\n1,Ada Lovelace\r\n2,Grace Hopper","column":"name","operator":"contains","literal":"Love"}'
```

The machine-readable contract is at [/v1/tools/csv-filter-pattern-literal/versions/1.0.0](/v1/tools/csv-filter-pattern-literal/versions/1.0.0).

### CLI

```sh
node cli.mjs run csv-filter-pattern-literal 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [CSV filter compare](/tools/csv-filter-compare): Filter ASCII CSV rows by string/decimal comparison; requires CRLF records, rejects LF-only and non-ASCII input.
- [CSV to markdown table](/tools/csv-to-markdown-table): Render ASCII CSV with CRLF records as Markdown; rejects LF-only records and non-ASCII text.
- [CSV dialect format](/tools/csv-dialect-format): Format string rows as CSV for an explicit dialect, quoting a one-field empty record when it can.
- [Table aggregate check](/tools/table-aggregate-check): Check claimed COUNT/SUM/AVG/MIN/MAX results over JSON rows exactly (SQL nulls); returns the first mismatch.
- [Table count distinct check](/tools/table-count-distinct-check): Check a claimed COUNT(DISTINCT) and optional distinct-value list over JSON rows; returns the first mismatch.
- [CSV dialect parse](/tools/csv-dialect-parse): Parse CSV with an explicit dialect into string rows, keeping leading zeros and embedded breaks.
