convert_to_csv
Extract tables from Markdown documents and convert them to CSV format. Parses GFM pipe-tables to output comma-separated values for data analysis and export.
Instructions
Extract tables from Markdown and convert them to CSV format. Parses GFM pipe-tables from the input and outputs comma-separated values. If the Markdown contains multiple tables, they are concatenated with a blank line separator. Non-table content is ignored. If the Markdown contains no tables, returns an empty string. Side effects: when output_path is provided, writes the CSV to disk (creates parent directories, overwrites existing files). When output_path is omitted, returns the CSV text directly as a string. Returns: CSV text string (if no output_path), or JSON { success, file_path, file_size_bytes, format } (if output_path set). Use this for lightweight tabular export or when downstream tools expect CSV. Prefer convert_to_xlsx for Excel-compatible spreadsheets with multiple sheets, or convert_to_json for structured data.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| markdown | Yes | The raw Markdown source text to convert. Supports GitHub-Flavored Markdown (tables, task lists, strikethrough) and KaTeX math expressions. Pass the full document content as a string, not a file path. | |
| output_path | No | Optional. Absolute or relative file path (e.g. './output.txt') where the result will be saved. Parent directories are created automatically. If omitted, the converted text content is returned directly in the response as a string. If provided, the file is written to disk and a JSON summary with { success, file_path, file_size_bytes, format } is returned instead. |