PDF Reader (PDF Agent Stack)

v0.23.0
io.github.shuji-bonji/pdf-reader-mcp Checked 8 hours ago Published 23 days ago

Read PDF internals: text, structure, fonts, signatures and tags, with what was not read declared.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_page_count Get PDF Page Count

Get the total number of pages in a PDF document. This is a lightweight operation that only reads the PDF header, not the full content. Args: - file_path (string): Absolute path to a local PDF file - response_format ('markdown' | 'json'): Output format (default: 'markdown') Returns: markdown (default) — the page count as a bare number, e.g. "126". This is the number the pages arguments of the other tools are checked against. json — { pageCount, scope }. scope.declaredCount is the /Count the root page tree node declares (ISO 32000-2 §7.7.3.2), scope.pagesReached is the number…

ParameterTypeDescription
file_path *stringAbsolute path to a local PDF file (e.g., "/path/to/document.pdf")
response_formatstringOutput format: "markdown" for human-readable, "json" for structured data

get_metadata Get PDF Metadata

Extract metadata from a PDF document including title, author, creation date, page count, PDF version, and structural information. Args: - file_path (string): Absolute path to a local PDF file - response_format ('markdown' | 'json'): Output format (default: 'markdown') Returns: Metadata including: title, author, subject, keywords, creator, producer, creation/modification dates, page count, PDF version, linearized/encrypted/tagged/signature flags, file size. The eight document-level fields are read from both the document information dictionary (ISO 32000-2 §14.3.3) and the XMP metada…

ParameterTypeDescription
file_path *stringAbsolute path to a local PDF file (e.g., "/path/to/document.pdf")
response_formatstringOutput format: "markdown" for human-readable, "json" for structured data

read_text Read PDF Text

Extract text content from a PDF document with Y-coordinate-based reading order preservation. Text is extracted page by page, sorted by vertical position (top to bottom) then horizontal position (left to right), providing natural reading order. `/ActualText` replacements (ISO 32000-2 §14.9.4) are resolved, on both of the paths that clause defines: the `/ActualText` of a structure element, and the one in a `Span` marked-content property list — the latter occurs in untagged documents too. So a word carried as ActualText (ligature substitutes, hyphenation fixes) reads here the way a person vi…

ParameterTypeDescription
file_path *stringAbsolute path to a local PDF file (e.g., "/path/to/document.pdf")
compact_whitespacebooleanWhen true, collapse runs of whitespace (incl. fullwidth space U+3000) to a single ASCII space and trim each line. Reduces token consumption on Japanese form-style PDFs. Default: false (no whitespace n…
pagesstringPage range to process. Format: "1-5", "3", or "1,3,5-7". Omit for all pages.
response_formatstringOutput format: "markdown" for human-readable, "json" for structured data
split_columnsintegerNumber of columns to use when reordering text. 1 (default) = existing Y-sort. 2 or 3 = bucket by X-coordinate left-to-right. Use for untagged 新旧対照表 / two-column PDFs where Y-sort would inter…

search_text Search PDF Text

Search for text within a PDF document. Returns matching locations with surrounding context. Case-insensitive search across all or specified pages. Each match includes the page number, the matched text, and configurable surrounding context. The search runs over the same text `read_text` returns, so `/ActualText` replacements (ISO 32000-2 §14.9.4) match: a word carried as ActualText (ligature substitutes, hyphenation fixes) is found under the spelling a viewer shows, not under its glyph form. Rarely, a page's marked content cannot be aligned with the extracted text and the replacement is left…

ParameterTypeDescription
file_path *stringAbsolute path to a local PDF file (e.g., "/path/to/document.pdf")
query *stringText to search for (case-insensitive)
context_charsintegerNumber of characters to show before and after each match
max_resultsintegerMaximum number of matches to return
pagesstringPage range to process. Format: "1-5", "3", or "1,3,5-7". Omit for all pages.
response_formatstringOutput format: "markdown" for human-readable, "json" for structured data

read_images Read PDF Images

Extract embedded images from a PDF document as PNG or JPEG files. Each image is returned as an MCP image content block, so a vision-capable model can look at it directly. A text block lists the metadata for all of them (page, index, size in the file, size returned, colour space, encoded bytes). These are the image XObjects the page draws, not a picture of the page. A page whose content is vector drawing, or whose text is what you want to see, is not covered by this tool. Response size is bounded: at most 4 MB of encoded image data per call. Images beyond the budget are named in the text blo…

ParameterTypeDescription
file_path *stringAbsolute path to a local PDF file (e.g., "/path/to/document.pdf")
formatstringEncoding of the returned images. png (default) is lossless; jpeg is smaller and drops alpha (composited over white).
max_heightintegerDownscale images taller than this. Never enlarges.
max_widthintegerDownscale images wider than this, averaging over the source pixels. Images are never enlarged. Omit to return each image at its own size.
pagesstringPage range to process. Format: "1-5", "3", or "1,3,5-7". Omit for all pages.
qualityintegerJPEG quality 1-100 (default 80). Ignored when format is png.

read_url Read PDF from URL

Fetch a PDF from a URL and extract its text content. Text is ALL this tool returns — see the scope note below. Downloads the PDF from the specified URL, then extracts text with Y-coordinate-based reading order. Supports HTTP and HTTPS. Maximum file size: 50MB. Timeout: 30 seconds. **Scope (#25):** the fetched bytes are discarded after extraction; this tool deliberately does not save them. Every other tool of this server takes a `file_path`, so to use search_text, inspect_structure, extract_tables, render_page or anything else on a URL's PDF, download the file to local disk FIRST (with what…

ParameterTypeDescription
url *stringURL pointing to a PDF file (HTTP or HTTPS)
compact_whitespacebooleanWhen true, collapse runs of whitespace (incl. fullwidth space U+3000) to a single ASCII space and trim each line. Reduces token consumption on Japanese form-style PDFs. Default: false (no whitespace n…
pagesstringPage range to process. Format: "1-5", "3", or "1,3,5-7". Omit for all pages.
response_formatstringOutput format: "markdown" for human-readable, "json" for structured data
split_columnsintegerNumber of columns to use when reordering text. 1 (default) = existing Y-sort. 2 or 3 = bucket by X-coordinate left-to-right. Use for untagged 新旧対照表 / two-column PDFs where Y-sort would inter…

render_page Render PDF Page

Rasterise pages of a PDF to PNG or JPEG images, returned as MCP image content blocks. This is the tool for documents whose text cannot be read as text: pages `read_text` reports as `no_text_layer` or `not_extractable`, vector drawings, forms, handwriting, stamps. It draws the PAGE — everything on it — where `read_images` only extracts the image XObjects a page happens to embed. Rendering uses PDFium compiled to WebAssembly (optional dependency `@hyzyla/pdfium`). Note this is a different engine from the pdf.js this server reads text with; where their behaviour on a damaged file differs, n…

ParameterTypeDescription
file_path *stringAbsolute path to a local PDF file (e.g., "/path/to/document.pdf")
pages *stringPage range to render. Required: rendering all pages is never implicit.
dpiintegerRasterisation density (default 150). PDF points are 1/72 inch.
formatstringpng (default, lossless) or jpeg (smaller — usually right for scans).
max_widthintegerCap on the rendered width in pixels; wins over dpi when smaller.
qualityintegerJPEG quality 1-100 (default 80). Ignored for png.

summarize Summarize PDF

Generate a quick overview report of a PDF document. Combines metadata, text presence check, image count, and a text preview from the first page into a single summary. Useful as a first step before deciding which detailed tools to use. Args: - file_path (string): Absolute path to a local PDF file - response_format ('markdown' | 'json'): Output format (default: 'markdown') `hasText` is decided from page 1's preview and cannot say *why* text is absent. `textExtractability` answers that over every page (ISO 32000-2 §9.10.1): `extracted`, `no_text_layer` (image content, no text-showing oper…

ParameterTypeDescription
file_path *stringAbsolute path to a local PDF file (e.g., "/path/to/document.pdf")
response_formatstringOutput format: "markdown" for human-readable, "json" for structured data

inspect_structure Inspect PDF Structure

Examine PDF internal object structure including catalog entries, page tree, and object statistics. Args: - file_path (string): Absolute path to a local PDF file - response_format ('markdown' | 'json'): Output format (default: 'markdown') Returns: Catalog entries (keys and COS types), page tree info (page count, MediaBox samples), object statistics, and encryption status. Object statistics report three separate counts: - byType: the COS type of each indirect object (ISO 32000-2 §7.3) — one of dict, stream, array, name, string, integer, real, boolean, null, ref - byDocType: t…

ParameterTypeDescription
file_path *stringAbsolute path to a local PDF file (e.g., "/path/to/document.pdf")
response_formatstringOutput format: "markdown" for human-readable, "json" for structured data

inspect_catalog Inspect PDF Catalog

List the document-level components hanging off the catalog dictionary (ISO 32000-2 §7.7.2, Table 29) — the parts of a PDF that are not page content and that page-oriented readers drop: bookmarks, layers, attachments, the XMP packet, and the actions that run when the document is opened. Args: - file_path (string): Absolute path to a local PDF file - max_outline_items (integer, 1-500, default 50): how many bookmark items to list (count and depth cover the whole tree) - include_xmp (boolean, default false): also return the XMP packet text (capped at 64 KiB) - response_format ('markdow…

ParameterTypeDescription
file_path *stringAbsolute path to a local PDF file (e.g., "/path/to/document.pdf")
include_xmpbooleanReturn the XMP packet text itself (capped at 64 KiB). Off by default: the declared values are extracted either way.
max_outline_itemsintegerHow many outline (bookmark) items to list. The count and depth are always computed over the whole tree.
response_formatstringOutput format: "markdown" for human-readable, "json" for structured data

inspect_tags Inspect Tagged PDF Structure

Analyze the Tagged PDF structure tree for accessibility assessment. Args: - file_path (string): Absolute path to a local PDF file - response_format ('markdown' | 'json'): Output format (default: 'markdown') Returns: Whether the PDF is tagged, the structure tree hierarchy with roles, max nesting depth, total element count, and role distribution (e.g., Document, P, H1, Table, Figure). For an encrypted PDF whose key cannot be derived from the empty user password, isTagged and the counts are null and a note says why: the structure tree could not be read, which is not the same answer as "…

ParameterTypeDescription
file_path *stringAbsolute path to a local PDF file (e.g., "/path/to/document.pdf")
response_formatstringOutput format: "markdown" for human-readable, "json" for structured data

inspect_fonts Inspect PDF Fonts

List all fonts used in a PDF document with their properties. Args: - file_path (string): Absolute path to a local PDF file - response_format ('markdown' | 'json'): Output format (default: 'markdown') Returns: Font name, type (TrueType, Type1, CIDFont, etc.), encoding, embedded/subset status, and pages where each font is used. Examples: - Check if all fonts are embedded (required for PDF/A, PDF/X) - Identify font types and encodings - Find which pages use specific fonts

ParameterTypeDescription
file_path *stringAbsolute path to a local PDF file (e.g., "/path/to/document.pdf")
response_formatstringOutput format: "markdown" for human-readable, "json" for structured data

inspect_annotations Inspect PDF Annotations

Extract and categorize all annotations in a PDF document. 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: Total annotation count, breakdown by subtype (Link, Widget, Highlight, Text, etc.) and by page, flags for links/forms/markup presence, and individual annotation details. Examples: - Check for form fields (Widget annotations) - Find all links in a document - Inventory markup annotati…

ParameterTypeDescription
file_path *stringAbsolute path to a local PDF file (e.g., "/path/to/document.pdf")
pagesstringPage range to process. Format: "1-5", "3", or "1,3,5-7". Omit for all pages.
response_formatstringOutput format: "markdown" for human-readable, "json" for structured data

inspect_signatures Inspect PDF Digital Signatures

Examine digital signature fields in a PDF document. Args: - file_path (string): Absolute path to a local PDF file - response_format ('markdown' | 'json'): Output format (default: 'markdown') Returns: Total signature field count, signed/unsigned breakdown, and details for each field (signer name, reason, location, signing time, filter/subFilter). Note: This tool inspects signature field structure only. Cryptographic signature verification is not performed. Examples: - Check if a PDF has been digitally signed - Inspect signer information and signing dates - Verify signature field…

ParameterTypeDescription
file_path *stringAbsolute path to a local PDF file (e.g., "/path/to/document.pdf")
response_formatstringOutput format: "markdown" for human-readable, "json" for structured data

extract_tables Extract Tables (Tagged PDF)

Extract every `<Table>` subtree from a Tagged PDF as a structured row/cell list, optionally rendered as Markdown tables. How it works: walks the document's StructTreeRoot depth-first (the same walker as `extract_structured_text` / `inspect_tags`) 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). A Table that continues across a page break is ONE table (ISO 32000-2 §14.8.2.5 NOTE 2) — `pages` is an…

ParameterTypeDescription
file_path *stringAbsolute path to a local PDF file (e.g., "/path/to/document.pdf")
pagesstringPage range to process. Format: "1-5", "3", or "1,3,5-7". Omit for all pages.
response_formatstringOutput format: "markdown" for human-readable, "json" for structured data

extract_structured_text Extract Structured Text

Extract a tagged PDF's text in logical content order, with each piece labelled by its structure type. This answers "what is the text of the H1?" — which read_text (flat, coordinate order), inspect_tags (structure, no text) and extract_tables (text, tables only) each cannot. Args: - file_path (string): Absolute path to a local PDF file - pages (string, optional): Page range ("1-5", "3", "1,3,5-7"). Omit for all pages. An element that touches the range is returned whole, even if it continues outside it. - roles (string[], optional): Structure types to include, e.g. ["H1","H2"] for…

ParameterTypeDescription
file_path *stringAbsolute path to a local PDF file (e.g., "/path/to/document.pdf")
include_bboxbooleanAlso report where each element is drawn, as boxes: one rectangle per page in PDF default user space (origin bottom-left, pt, normalised) — the form pdf-writer-mcp add_annotation takes. Each carries…
pagesstringPage range to process. Format: "1-5", "3", or "1,3,5-7". Omit for all pages. An element that touches the range is returned whole, even if it continues outside it.
response_formatstringOutput format: "markdown" for human-readable, "json" for structured data
rolesarrayStructure types to include, e.g. ["H1","H2"] to extract an outline. Omit for all roles.

locate_objects Locate PDF Objects (object number → page and rectangle)

Report where the given objects sit on the page. Bridges "which object" to "which coordinates": pdf-verify-mcp's verify_integrity names the objects an incremental update changed, and pdf-writer-mcp's add_annotation wants a page number and a rectangle. The rectangle is returned in PDF user space (origin bottom-left, pt, x1 < x2 and y1 < y2 — ISO 32000-1 §7.9.5 normalised form), which is exactly what add_annotation takes. Args: - file_path (string): Absolute path to a local PDF file - object_numbers (number[]): Object numbers to locate, e.g. [25, 27] - response_format ('markdown' | 'js…

ParameterTypeDescription
file_path *stringAbsolute path to a local PDF file (e.g., "/path/to/document.pdf")
object_numbers *arrayObject numbers to locate, e.g. [25, 27]. Typically the objects pdf-verify-mcp's verify_integrity reported as changed.
response_formatstringOutput format: "markdown" for human-readable, "json" for structured data

compare_structure Compare PDF Structures

Compare the internal structures of two PDF documents and identify differences. Args: - file_path_1 (string): Absolute path to the first PDF file - file_path_2 (string): Absolute path to the second PDF file - response_format ('markdown' | 'json'): Output format (default: 'markdown') Returns: Structural comparison including: property-by-property diff (page count, PDF version, encryption, tagged status, object counts, page dimensions, file size, catalog entries, signatures), font comparison (fonts unique to each file and shared fonts), and a summary. The comparison needs both files,…

ParameterTypeDescription
file_path_1 *stringAbsolute path to the first PDF file for comparison
file_path_2 *stringAbsolute path to the second PDF file for comparison
response_formatstringOutput format: "markdown" for human-readable, "json" for structured data