Extract Tables (Tagged PDF)
extract_tablesExtract tables from tagged PDFs: walks structure tree to pull cell text, outputting as Markdown or JSON for structured data.
Instructions
Extract every <Table> subtree from a Tagged PDF as a structured row/cell list,
optionally rendered as Markdown tables.
How it works: walks the StructTree and pulls cell text for each <TR> →
<TH>/<TD>, then collapses kerning whitespace (e.g. "消 費 税 法" → "消費税法").
This sidesteps reading-order extraction's failure mode on multi-column tables
(typical of 新旧対照表 PDFs).
Args:
file_path (string): Absolute path to a local PDF file
pages (string, optional): Page range. Format: "1-5", "3", or "1,3,5-7". Omit for all pages.
response_format ('markdown' | 'json'): Output format (default: 'markdown')
Returns:
Markdown — # Extracted Tables summary block followed by one
## Page N — Table M section per table with a GFM table.
JSON — { isTagged, tables: [{ page, index, headerRows, bodyRows, footerRows }], totalTables, pagesScanned, note? }.
Limitations:
Untagged PDFs return an empty result and a
note.colspan/rowspan are not honoured (cells are listed in source order).
Nested tables are skipped to keep page indices stable.
Examples:
Pull 新旧対照表 from a kaisei tsutatsu PDF for diffing
Convert 帳票 (form template) tables into structured data
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | Absolute path to a local PDF file (e.g., "/path/to/document.pdf") | |
| pages | No | Page range to process. Format: "1-5", "3", or "1,3,5-7". Omit for all pages. | |
| response_format | No | Output format: "markdown" for human-readable, "json" for structured data | markdown |