Loading...
Loading...
Extract plain text from a document file - PDF, DOCX, XLSX, PPTX, RTF, or plain text/markdown/HTML. Use when a binary document needs to be turned into text, for example a contract PDF or an EHR DocumentReference attachment. Other skills (fhir) invoke scripts/extract.ts directly; the contracts MCP server bundles its own copy (servers/documents/src/extract.mjs) so its bundle stays self-contained — port fixes to both.
npx skill4agent add anthropics/healthcare doc-extractcd <this skill dir> && bun installlitpdftotext -layoutbun <this skill dir>/scripts/extract.ts <input-file> [--content-type <mime>]{ "text": "...", "method": "liteparse | pdftotext | rtf-to-text | passthrough", "pages": 12 }text=== [page N] ===pagesmethod--content-typeapplication/pdfpdftotext{"error": "..."}=== [page N] ===pagesimport { extract, resolveLit } from "../doc-extract/scripts/extract";
const lit = resolveLit([myRoot]); // also checks myRoot/node_modules/.bin/lit
const text = extract(lit, "/path/to/file.pdf"); // string | null