Skip to content

MCP tools ​

anymd exposes three tools.

ToolUse it to
readTurn a file, URL, or folder into Markdown
searchFind text across files, folders, and URLs
inspectGo deeper on a PDF: render pages, crop regions, OCR, JSON structure, compare

read ​

Any file, URL, or directory → Markdown.

ArgumentTypeDefaultDescription
sourcestringrequiredFile path, http(s) URL, or directory. A directory returns the list of readable files.
pagesstringallPages (PDF), slides, sheets, or chapters, e.g. "1-5,8"
max_tokensnumber ≥ 50020000Token budget. Longer documents stop at a page/slide/chapter boundary and end with a cursor.
cursorstring–Continue a previous read with the cursor from its last line
ocrbooleanautomaticOCR images and image-only PDF pages with a local tesseract. Automatic when tesseract is installed; false disables.
transcriptbooleanfalseTranscribe audio/video with a local whisper.cpp
download_whisper_modelbooleanfalseImplies transcript; downloads the ggml model (base.en, 148 MB, SHA-256 verified) into the anymd cache when none is installed
json
{ "source": "papers/attention.pdf" }
markdown
---
source: papers/attention.pdf
title: Attention Is All You Need
pages: 15
showing: pages 1-9
---

<!-- page 1 -->

# Attention Is All You Need
…

<!-- page 8 -->

|Model|BLEU EN-DE|BLEU EN-FR|
|-|-|-|
|Transformer (big)|28.4|41.8|
…

<!-- Stopped at the 20000-token budget. Continue with cursor: "10", or pick pages, or raise max_tokens. -->

Cursor and pagination ​

When a document is larger than max_tokens, read stops at a unit boundary (a page, slide, sheet, or chapter) and its last line names the cursor to continue from. Pass it back unchanged:

json
{ "source": "papers/attention.pdf", "cursor": "10" }

A cursor is "<page>" or, when a single page was larger than the whole budget and had to be split, "<page>:<offset>". You can also skip the cursor and ask for exactly what you need with pages, or raise max_tokens.

Folders and URLs ​

read on a directory lists the readable files in it, so the agent can pick one or search them all. read on a web URL returns the main article only; see Formats.

Find text across files, directories, and URLs, one line per hit.

ArgumentTypeDefaultDescription
querystringrequiredText to find
sourcesstring[]current directoryFiles, directories (searched recursively, .gitignore respected), or URLs. Up to 256.
modestringautoauto: exact phrase, falling back to ranked passages when nothing matches. literal: exact phrase only. ranked: BM25 over the query words.
globstring–Only files matching this glob inside directories, e.g. "*.pdf" or "reports/**"
case_sensitivebooleanfalseMatch case
whole_wordbooleanfalseMatch whole words
max_resultsnumber 1–50020Maximum hits
context_charsnumber 0–100080Snippet context on each side
json
{ "query": "masked language model", "sources": ["papers/"] }
markdown
5 matches for "masked language model" (2 files, 31 sections searched)

### papers/bert.pdf (5)
- p.1: …by using a “**masked language model**” (MLM) pre-training objective, inspired by the Cloze task…
- p.2: …In addition to the **masked language model**, we also use a “next sentence prediction” task…

In auto mode, a question like "how does bidirectional pretraining work" that matches nothing exactly still finds the right page through BM25-ranked passages.

inspect ​

Go deeper on a PDF. inspect returns JSON, for the cases where an agent needs geometry, images, or a diff rather than prose.

operationWhat it does
inspectPage count, metadata, and per-page facts
render_pageRender pages to PNG images
extract_regionsCrop regions (bounding boxes) out of rendered pages
ocr_pagesOCR pages with the local OCR provider
analyze_regionsSend regions to a configured vision/region provider
structureStructured JSON read: document map, elements, geometry, tables, and reports
comparePage-level text diff between two local PDFs (sources[0] = before, sources[1] = after)
ArgumentTypeDescription
operationstringOne of the operations above (required)
sourcesobject[]{ path | url, pages?, regions? } per PDF. A region is { page, bounding_box: { left, bottom, right, top }, padding? }.
profilestringstructure only: fast (default), quality, or research (adds safety, trust, and accessibility reports)
scalenumber 0.25–4Render scale for render_page / extract_regions
max_pagesnumber 1–20Page cap for rendering and OCR
max_regionsnumber 1–100Region cap
max_pixels_per_pagenumberPixel cap per rendered page
include_imagebooleanInclude the rendered PNG in the response
languagesstring[]OCR languages, e.g. ["eng", "chi_tra"]
timeout_msnumberTime limit for external tools (1,000–300,000)
max_output_charsnumberOutput cap (1,000–1,000,000)

Render page 3 at 2×:

json
{ "operation": "render_page", "sources": [{ "path": "report.pdf", "pages": [3] }], "scale": 2 }

Get the structured JSON (elements with bounding boxes, tables, outline):

json
{ "operation": "structure", "sources": [{ "path": "report.pdf" }], "profile": "quality" }

Diff two versions:

json
{ "operation": "compare", "sources": [{ "path": "contract-v1.pdf" }, { "path": "contract-v2.pdf" }] }

Legacy tool names ​

The pdf-reader-mcp tool names read_pdf, search_pdf, pdf_evidence, and pdf_compare still work for this major version. They no longer appear in tools/list. See Migration.

MIT licensed · local, no API key