Local PDF tools for AI agents, exposed over the Model Context Protocol
BensPDF has well-structured tool definitions with clear naming (verb_noun pattern: pdf_extract_text, pdf_check_access) and comprehensive descriptions (avg 180 chars, well above 10-char minimum). All 12 tools have descriptions and input schemas with type definitions. However, several parameters lack descriptions (e.g., pdf_page_layout 'page' param has type but minimal context), and output schemas are not formally documented in the visible code. Error handling is present but generic (returns err/ok tuples without recovery guidance). Tool composition is sound, each tool has a single responsibility. The export tool properly handles both single and batch operations with clear parameter semantics.
Create a test PDF file for development and testing.
Delete temporary artifacts from the workspace now. Only accepts artifact ids, never file paths, so this cannot delete the user's own files. Artifacts expire on their own, so this is only needed when the user explicitly asks to clean up.
Save one or more results to a real location on disk. The only tool that writes to the user's filesystem, so call it once at the end, when they have said where the output should go. Never hand an artifact id back as if it were a finished file; artifacts expire.
List recent temporary artifacts in the workspace, newest first. Useful when you have lost track of an artifact id from earlier in the conversation, so you can find it again instead of redoing the work.
Check a PDF's encryption and what it permits: printing, copying, editing. Answers "is this locked, and what am I allowed to do with it?". `encrypted` and `needs_password` are separate answers and the difference matters: most encrypted files have no user password, so they open silently and only carry restrictions. `permissions` gives a boolean per action, `restrictions` lists what is denied, and an unencrypted file permits everything — a PDF has nowhere to keep restrictions but its encryption dictionary. Treat restrictions as what the file asks
Three tools (pdf_page_layout, pdf_render_pages, pdf_ocr) have minimal descriptions (under 50 chars). pdf_page_layout: 'Read the layout of a PDF page: text boxes, images, and their positions.' lacks WHEN to use it and what the output structure contains. pdf_render_pages and pdf_ocr similarly lack context on output format and use cases.
Output schemas are not formally documented in visible code. Tools return results via err/ok tuples, but the structure of success payloads (e.g., what fields pdf_metadata returns, what pdf_extract_text yields) is not declared in the tool registration. LLMs cannot plan downstream calls without knowing output structure.
Error responses use generic err() tuples without recovery guidance. When pdf_extract_text fails, the LLM receives only the error message, not 'Try pdf_check_text() first to verify the document has a text layer' or 'This page may be scanned; use pdf_ocr instead.' Errors should guide the next action.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | C | 61 | 2025-06-18+ | v2 |
Check whether a PDF has a text layer, looks scanned, or needs OCR. Answers "can I read this, or is it a picture of a document?". Worth running before extracting text from a file you have not seen. `verdict` is "text", "scanned", "mixed", or "no_text" — the last meaning nothing readable but nothing scan-like either, so blank, vector-only, or illustrated pages that OCR cannot help. `needs_ocr` follows from it, `summary` is a sentence worth quoting, and the per page evidence behind the verdict comes back alongside, including each page's `image_coverage` (the largest image's share of the page area). Samples up to 10 pages spread across the document, so a true `sampled` means the answer is an estimate for the pages in between. It does not return the text (use pdf_extract_text) and it does not run OCR.
Read the text of a PDF that has one, page by page. The cheap and exact way to read a document: milliseconds a page, and the characters are the ones the file holds. Prefer it to pdf_ocr, which is for pages carrying no text, and to pdf_render_pages, which costs an image a page. pdf_check_text says which path a file needs; page numbers come back with the text, so quote page 8 rather than "the document". A long document arrives in ranges: one call returns about 50,000 characters and names the pages it did not reach, so when `truncated`, do what the summary says. `output="txt"` writes the whole extraction to an artifact and returns the counts alone, which is the way to read a book. Text on a `text_suspect` page came back partly undecodable, because the fonts carry no character map: say so rather than quoting it, and look at the page with pdf_render_pages.
Read a PDF's document properties: title, author, dates, producer, keywords. Answers "who made this, when, and with what". It does not count pages (use pdf_page_count) and says nothing about whether the pages hold readable text (use pdf_check_text). A PDF can store these fields in two independent places, the legacy Info dictionary and an XMP packet, and the two often disagree. The normalized answer is at the top level, preferring XMP, with `sources` naming the store each value came from and `conflicts` listing every field where the two differ, both values included. Both stores also come back verbatim as `info` and `xmp`. When `has_conflicts` is true, say so rather than quoting one value as fact.
Extract text from a scanned PDF using OCR.
Count the pages in a PDF. Answers "how many pages is this?". Reads only the document's page tree, so it stays cheap on large files. It does not read page text, page sizes, or document properties.
Read the layout of a PDF page: text boxes, images, and their positions.
Render PDF pages to PNG images.
Parameter descriptions are inconsistent. 'ref' parameters in pdf_* tools say 'PDF file path, or a workspace artifact id' but do not specify format constraints (e.g., must be absolute path, or valid artifact UUID). 'pages' parameter in pdf_extract_text says 'Which pages: "1-10", "3", "1,5,9-12" or "all"' but lacks a formal pattern or enum.
create_test_pdf_file is a development/testing tool exposed in production. It should be gated behind a feature flag or removed from the public API. Agents should not create test files in user workspaces.