AnchorDoc

v0.9.3
io.github.ryanvii/anchordoc Checked 1 day ago Published 7 days ago

Zero-LLM MCP server for long-PDF navigation, evidence localization, quote verification & AST math.

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

doc_outline

Build a token-bounded L0 structural outline of a PDF (<=1,500 tokens, zero LLM calls). Returns doc_id, page count, printed-to-physical page calibration, route_hint ('read_all' or 'navigate'), and zoomable section/statement headings. Call this first once per PDF.

ParameterTypeDescription
depthintegerHeading granularity depth (1 = top-level sections & primary statements, 2–3 = finer subsections).
doc_idstringOpaque document handle returned by an earlier doc_outline call to avoid re-specifying path.
max_itemsintegerMaximum outline items returned to keep token usage bounded.
page_rangearrayOptional [start_page, end_page] 1-based physical page bounds to zoom into a specific section.
pathstringAbsolute or relative path to a PDF file inside allowed --root directories (required on first call if doc_id is omitted).

doc_locate

Locate the most relevant pages and snippets in a PDF without calling any LLM (<=1,200 tokens). Combines lexical BM25-RRF, printed page references, statement-intent boosting, and table continuations. Call after doc_outline before reading pages.

ParameterTypeDescription
query *stringSpecific search query containing key entities, metrics, table names, or clause terms.
doc_idstringPreviously opened doc_id returned by doc_outline.
kintegerNumber of top candidate pages to return (1–10).
page_rangearrayOptional [start_page, end_page] 1-based physical page range to restrict search.
pathstringPath to a PDF inside allowed --root directories (optional if doc_id is supplied).
snippet_charsintegerMaximum character length of each returned preview snippet.

doc_read

Read up to 5 specific PDF pages per call (<=6,000 tokens) with stable line anchors (e.g. p12:L07) and a session duplicate-read ledger. Optionally renders page PNGs or 2x2 zoom tiles as native MCP ImageContent for charts or scanned pages.

ParameterTypeDescription
pages *array1-based physical page numbers to read (1 to 5 pages per call).
doc_idstringPreviously opened doc_id returned by doc_outline.
forcebooleanSet true to re-return pages already recorded in the session read ledger.
imagestringVisual rendering mode: 'false' (text only), 'page' (full-page PNG), or 'tiles' (2x2 high-res zoom crops).
line_rangearrayOptional [start_line, end_line] 1-based line bounds within each requested page.
max_chars_per_pageintegerCharacter cap per page to protect context window budget.
pathstringPath to a PDF inside allowed --root directories (optional if doc_id is supplied).

doc_verify

Deterministically verify any claim against a source PDF with zero LLM calls. Checks sign-preserving verbatim quotes, binds numeric operands to table rows/periods/units, detects sign flips, period/unit/pp-vs-% swaps, and recomputes symbolic or numeric formulas via Python AST. Always call before finalizing high-stakes answers.

ParameterTypeDescription
cited_pagesarrayOptional list of 1-based physical page numbers cited as evidence.
claim_textstringOptional natural-language claim to audit for metric/period/pp-vs-% alignment.
claimed_unitstringOptional unit of claimed_value (e.g., million, billion, %, pp).
claimed_valuenumber | stringOptional claimed numeric result to check against AST recomputation.
doc_idstringPreviously opened doc_id returned by doc_outline.
formulastringSymbolic (e.g. 'rev - cogs') or numeric arithmetic formula recomputed deterministically via Python AST.
operandsarrayOptional structured operands bound to row_label, period, unit, and page for anti-laundering verification.
pathstringPath to a PDF inside allowed --root directories (optional if doc_id is supplied).
quotesarrayVerbatim quote strings or {text, page?} objects to verify against exact PDF text.
strict_scalebooleanIf true, disallow implicit 1000x/1e6x unit scaling during numeric matching.