parse_csv
Parse CSV strings into structured data for development workflows. Specify delimiters to handle various CSV formats and extract usable information from raw data.
Instructions
Parse CSV data
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | CSV string to parse | |
| delimiter | No | CSV delimiter | , |
Implementation Reference
- src/tools/api-discovery.ts:225-239 (handler)The handler function for the 'parse_csv' tool. It parses a CSV string into an array of objects, using the first row as headers and the specified delimiter.case 'parse_csv': { const data = params.data as string; const delimiter = (params.delimiter as string) || ','; const lines = data.split('\n'); const headers = lines[0].split(delimiter); const rows = lines.slice(1).map((line) => { const values = line.split(delimiter); const obj: Record<string, string> = {}; headers.forEach((header, index) => { obj[header.trim()] = values[index]?.trim() || ''; }); return obj; }); return rows; }
- src/tools/api-discovery.ts:118-137 (registration)Registration of the 'parse_csv' tool in the apiDiscoveryTools array, including its name, description, and input schema.{ name: 'parse_csv', description: 'Parse CSV data', inputSchema: { type: 'object', properties: { data: { type: 'string', description: 'CSV string to parse', }, delimiter: { type: 'string', description: 'CSV delimiter', default: ',', }, }, required: ['data'], }, }, {
- src/tools/api-discovery.ts:118-137 (schema)Input schema definition for the 'parse_csv' tool, specifying the expected parameters.{ name: 'parse_csv', description: 'Parse CSV data', inputSchema: { type: 'object', properties: { data: { type: 'string', description: 'CSV string to parse', }, delimiter: { type: 'string', description: 'CSV delimiter', default: ',', }, }, required: ['data'], }, }, {