document-mcp

v4.14.248
document-mcp Checked 15 minutes ago Published 16 hours ago

MCP (Model Context Protocol) server exposing documents.js's document-conversion, .odb, metadata, and font tooling as MCP tools.

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

compute_formula Compute document formulas

Reads every formula a document embeds (docx/odt/markdown paragraphs and pptx/odp slide shapes; a table cell's own blocks too — docx's own reader recovers a real equation nested inside a table cell; structurally, the walk also covers a drawing page's own shape flow, though no writer in the family populates a formula there today; a spreadsheet's own cell-anchored formula objects; a standalone .odf formula document; and a formula nested inside another embedded object at any depth, e.g. a formula embedded in a drawing embedded in a spreadsheet) and evaluates each through document-compute.js's un…

ParameterTypeDescription
source *The document to read formulas from.
bindingsobjectKnown values for symbols the document's formulas reference, keyed by symbol-table id (a Quantity { kind: 'quantity', magnitude, dimension } or an Interval { kind: 'interval', min, max, dimension } per…

convert_document Convert document

Converts a document from one supported format to another via documents.js's DocumentConverter port — docx, pptx, xlsx, odt, odp, ods, odg, odf, markdown, rtf, wpd, doc, xls, ppt, epub, csv, svg, and pdf. Not every (source, targetFormat) pair is supported directly (odf, for instance, only ever converts to pdf); call list_document_conversions first to see which pairs actually are.

ParameterTypeDescription
source *The document to convert.
targetFormat *stringThe format to convert the document to. Not every (source, targetFormat) pair is supported directly — call list_document_conversions first to confirm this one is.
fontsarrayExtra font faces to make available to the conversion, for a family the source document does not already embed. Only consulted by a conversion that runs a layout engine (a <format>-to-pdf conversion);…
imagesobjectA map from a markdown image destination (the part in the parentheses of ![](..)) to its base64-encoded PNG/JPEG bytes, for resolving a markdown source's own non-data: images. Only consulted by a markd…
onSubstitutionDiagnosticsbooleanWhen true, additionally report each individual font-substitution event as structured fontSubstitutions (which family/weight/style was requested, what it resolved to instead, and why). Every substituti…
outputobjectWhere to write the converted document. Omit entirely to receive the bytes inline, base64-encoded, instead.

list_document_conversions List document conversions

Lists every (source, target) format pair convert_document actually supports, straight from documents.js's own DocumentConverter port — the definitive source of truth for what convert_document will and will not accept as a (source, targetFormat) combination.

docx_extras Docx extras

Reads a docx's own comments, footnotes, header/footer parts, and numbering definitions — data documents.js's ContentDocument pivot cannot carry, so ordinary document-reading operations never see it. Returns the real DocxExtras object (comments/footnotes/headerFooterParts/sectionHeaderFooters/numbering) as structured data.

ParameterTypeDescription
source *The docx document to read.

document_create Create a blank document

Creates a fresh, blank document in the given format via documents.js's own live-view editors (createDocx/createOdt/createMarkdownEditor/...), the same construction document_append_paragraphs's own edit calls build on. Returns an empty document with no content — follow with document_append_paragraphs (docx/odt/markdown) to add text.

ParameterTypeDescription
format *stringThe format of document to create.
outputobjectWhere to write the created document. Omit entirely to receive the bytes inline, base64-encoded.

document_append_paragraphs Append paragraphs to a wordprocessing document

Appends one or more paragraphs — each optionally built from several independently-formatted runs — to the end of a docx, odt, or markdown document, through documents.js's own live-view editors (the same DocxBody.appendParagraph/OdtBody.appendParagraph/MarkdownBody.appendParagraph document-cli's own TUI uses). Does not convert format — the source document's own format and targetFormat must match. docx and odt share an identical field set (underline, fontFamily, sizePt, colorHex, headingLevel, alignment all supported); markdown supports a different, smaller set (hyperlink, code) and reject…

ParameterTypeDescription
paragraphs *arrayThe paragraphs to append, in order.
source *The document to append paragraphs to.
targetFormat *stringMust match the source document's own format. document_append_paragraphs never converts format.
outputobjectWhere to write the edited document. Omit entirely to receive the bytes inline, base64-encoded.

fonts List document fonts

Lists every source-embedded font face a docx/pptx/odt/odp/ods/odg document carries (family, weight/style, byte length).

ParameterTypeDescription
source *The docx/pptx/odt/odp/ods/odg document to extract source-embedded font faces from.

describe_font_file Describe font file

Reads a standalone TrueType/OpenType font file (.ttf/.otf) and reports the family/bold/italic triple it declares about itself.

ParameterTypeDescription
source *The standalone .ttf/.otf font file to inspect — not a document.

from_package Build document from package

Rebuilds real document bytes in a target format from a DocumentTree previously serialised to JSON (e.g. by a caller's own --dump-package-equivalent step) — the read side of the DocumentTree round trip a conversion's onDocument callback produces.

ParameterTypeDescription
source *The DocumentTree JSON to read. 'path' points at a JSON file on disk — its extension is never used to infer a document format, since the file holds a DocumentTree, not a document. 'bytesBase64' carri…
targetFormat *stringThe document format to build from the DocumentTree.
outputobjectWhere to write the resulting document. Omit entirely (or omit outputPath within it) to receive the bytes inline instead.

metadata_read Read document metadata

Reads a document's own title/author/subject/keywords/creator/producer/created-and-modified-timestamp metadata. Works across every supported format, including xlsx (read via a throwaway xlsx-to-pdf preview, since documents.js has no dedicated xlsx metadata reader of its own) and odf (a standalone formula document).

ParameterTypeDescription
source *The document to read metadata from.

metadata_write Write document metadata

Patches a document's own title/author/subject/keywords, leaving every other field and every other flag as-is. Does not convert format — the source document's own format and targetFormat must match (or both be 'pdf'); odf (a standalone formula document) is rejected outright as either a source or a target, since it has no write path back out at all. Convert the document to a different format first (e.g. with a documents.js conversion operation) if metadata needs to be set on the result of a format change.

ParameterTypeDescription
source *The document to patch metadata on.
targetFormat *stringThe format to write the patched document back out as — must match the source document's own format (or both be 'pdf'). metadata_write never converts format.
outputobjectWhere to write the patched document. Omit entirely to receive the bytes inline, base64-encoded.
setAuthorstringSet the author field. Omit to leave it exactly as the source document already has it.
setKeywordsarraySet the keywords field. Omit to leave it exactly as the source document already has it.
setSubjectstringSet the subject field. Omit to leave it exactly as the source document already has it.
setTitlestringSet the title field. Omit to leave it exactly as the source document already has it.

odb_tables List .odb tables

Lists every table an embedded .odb database declares — column names, types, and row data — across every storage tier documents.js supports (HSQLDB TEXT/CACHED/BINARY script formats, Firebird gbak backups).

ParameterTypeDescription
source *.odb database to read. 'path' points at the .odb file on disk — its extension is never used to infer a document format, since documents.js deliberately excludes 'odb' from DocumentFormat (an embedde…

odb_forms List .odb forms

Lists every form an .odb database declares, with each form's own data source and field-bound controls.

ParameterTypeDescription
source *.odb database to read. 'path' points at the .odb file on disk — its extension is never used to infer a document format, since documents.js deliberately excludes 'odb' from DocumentFormat (an embedde…

odb_reports List .odb reports

Lists every report an .odb database declares, with each report's own data-source command, band/group structure, and rpt: formula expressions.

ParameterTypeDescription
source *.odb database to read. 'path' points at the .odb file on disk — its extension is never used to infer a document format, since documents.js deliberately excludes 'odb' from DocumentFormat (an embedde…

odb_query Query an .odb database

Runs a bounded SELECT (with optional JOINs of any kind, table aliases, a derived table in FROM, and IN/EXISTS subqueries) over an embedded .odb database's own extracted tables, given directly as SQL or by naming one of the database's saved queries. No database engine is involved — the query runs in memory over the same tables odb_tables would return, against a closed grammar (SELECT/FROM/JOIN [INNER|LEFT [OUTER]|RIGHT [OUTER]|FULL [OUTER]|CROSS|NATURAL] ... [ON|USING]/WHERE/GROUP BY/ORDER BY, with an optional [AS] alias on any table, WHERE and ON also accepting [NOT] IN (SELECT ...) and [NOT…

ParameterTypeDescription
source *.odb database to read. 'path' points at the .odb file on disk — its extension is never used to infer a document format, since documents.js deliberately excludes 'odb' from DocumentFormat (an embedde…
querystringThe name of one of the .odb's own saved queries to run. Mutually exclusive with "sql".
sqlstringA literal SELECT statement to run. Mutually exclusive with "query".

odb_to_csv Export one .odb table to CSV

Extracts exactly one named table from an embedded .odb database as CSV bytes. The table name is required whenever the database declares more than one table.

ParameterTypeDescription
source *.odb database to read. 'path' points at the .odb file on disk — its extension is never used to infer a document format, since documents.js deliberately excludes 'odb' from DocumentFormat (an embedde…
outputobjectWhere to write the resulting CSV. Omit entirely (or omit outputPath within it) to receive the bytes inline instead.
tablestringThe table to export — required when the .odb declares more than one table.

odb_to_xlsx Export .odb tables to xlsx

Extracts every table an embedded .odb database declares into one xlsx workbook, one sheet per table.

ParameterTypeDescription
source *.odb database to read. 'path' points at the .odb file on disk — its extension is never used to infer a document format, since documents.js deliberately excludes 'odb' from DocumentFormat (an embedde…
outputobjectWhere to write the resulting xlsx workbook. Omit entirely (or omit outputPath within it) to receive the bytes inline instead.

odb_render_report Render .odb report

Resolves one of an .odb database's own reports — its data-bound command run through the bounded SQL engine, its rpt: formulas evaluated, its bands laid out — and renders the result to docx, odt, or pdf.

ParameterTypeDescription
source *.odb database to render a report from. 'path' points at the .odb file on disk — its extension is never used to infer a document format, since documents.js deliberately excludes 'odb' from DocumentFo…
targetFormat *stringThe format to render the report into.
fontsarrayExtra font faces to make available, for a family the rendered report's own text otherwise falls back on. Only consulted when targetFormat is 'pdf' — docx and odt output is genuine editable text with…
outputobjectWhere to write the rendered report. Omit entirely (or omit outputPath within it) to receive the bytes inline instead.
reportstringThe name of the report to render. Required only when the .odb declares more than one report — omitting it when exactly one is declared renders that one automatically.

odm_to_pdf Convert ODM master document to PDF

Converts a .odm (ODF master document) to PDF. A .odm never carries its own chapters' content inline — every text:section is a bare external reference to a standalone .odt file — so each chapter the master document declares must resolve through `chapters` (an explicit href -> document override) and/or `chaptersDir` (a directory searched by the href's own basename), checked in that order. A chapter left unresolved by both fails the whole conversion, naming every unresolved href.

ParameterTypeDescription
source *The .odm master document to convert.
chaptersarrayExplicit href -> chapter document overrides. Checked before chaptersDir for a given href.
chaptersDirstringDirectory to search for each unresolved chapter href, matched by the href's own basename. Checked after chapters.
outputobjectWhere to write the resulting PDF. Omit to receive the bytes inline, base64-encoded.

outline_document Outline document

Projects a document's table of contents as a structured outline: reads the source's own native DocumentTree directly (documents.js's readNativeDocumentTree — no bridging conversion, no discarded output bytes) and runs document-outline.js's buildOutline over it. Groups carry { text, level, children } (a heading's, list item's, slide's, sheet's, or page's own label plus nested children); leaves carry { kind, text }.

ParameterTypeDescription
source *The document to outline.

pdf_inspect Inspect PDF

Parses a PDF (documents.js's readPdf) and reports a summary: page count, each page's own size and item-kind histogram, document metadata, and embedded image formats. Pass full: true to return the entire parsed LayoutDocument instead of a summary.

ParameterTypeDescription
source *The PDF document to inspect.
fullbooleanWhen true, return the entire parsed LayoutDocument instead of a summary. Defaults to false.