mcp
v0.11.1MCP server for open-doc — lets any agent framework list, read, write, and file documents over Streamable HTTP or stdio.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
list_documents List documents
Every document in the workspace with its id, title, theme, and folder. Start here.
read_document Read document source
The TSX source of a document. A document is React — read it before editing it. For a long document, call outline_document first and pass fromLine/toLine to read only the part you change; leave both out for the whole file.
| Parameter | Type | Description |
|---|---|---|
docId * | string | |
fromLine | integer | first line to read, 1-based |
toLine | integer | last line to read, inclusive |
outline_document Outline document source
Where things are in a document without its source: line count, each top-level block (design, components, pages) with its line range, and every h1–h3 with its line. Start here with a long document, then read_document with fromLine/toLine.
| Parameter | Type | Description |
|---|---|---|
docId * | string |
search_document Search document source
Every line of a document’s source that contains some exact text (a colour such as #fff, a component, a phrase), with its line number. Finds what to change across a long document without reading all of it.
| Parameter | Type | Description |
|---|---|---|
docId * | string | |
text * | string | exact, case-sensitive text to look for |
edit_document Replace exact text in the source
Change one exact piece of a document’s source: `find` (copied exactly from read_document or search_document, spacing and quotes included) becomes `replace`. `find` must occur once — pass fromLine/toLine (the range you read) when the same text appears elsewhere — unless `all` is set to change every occurrence. Use it for small changes instead of rewriting the whole file with write_document.
| Parameter | Type | Description |
|---|---|---|
docId * | string | |
find * | string | the exact text to change |
replace * | string | what it becomes |
all | boolean | change every occurrence, not just one |
expectedHash | string | optional 16-char hash from read_document; refuses the edit if the file changed |
fromLine | integer | look for `find` only from this line (1-based), e.g. the range you read |
toLine | integer | …to this line, inclusive |
create_document Create document
Write a new docs/<id>/index.tsx. Fails if the id is taken. Read a theme first and follow its components.
| Parameter | Type | Description |
|---|---|---|
docId * | string | kebab-case folder name under docs/ |
source * | string | complete TSX module source |
list_templates List templates
Templates a new document can start from — built-in and the workspace’s own templates/<name>/. The `name` is what create_from_template takes.
create_from_template Create document from template
Copy a template into docs/<id>/, retitled and dated today. Start here rather than from a blank file when a template fits; call list_templates for the names.
| Parameter | Type | Description |
|---|---|---|
template * | string | a name from list_templates |
docId | string | kebab-case folder name; derived from the title when omitted |
title | string | meta.title of the new document |
write_document Overwrite document source
Replace a document’s source. Pass `expected` (the source you read) or `expectedHash` (the 16-char SHA-256 hash returned by read_document) to be refused instead of clobbering a concurrent edit.
| Parameter | Type | Description |
|---|---|---|
docId * | string | |
source * | string | |
expected | string | the source you last read; enables conflict check |
expectedHash | string | the 16-char hash returned by read_document; enables lightweight conflict check |
rename_document Rename document
Rewrites meta.title in the source. The document id never changes.
| Parameter | Type | Description |
|---|---|---|
docId * | string | |
title * | string | |
expectedHash | string | optional 16-char hash from read_document; refuses write if file changed |
duplicate_document Duplicate document
Copies the folder to a fresh id, lands in the same folder as the original.
| Parameter | Type | Description |
|---|---|---|
docId * | string | |
newId | string |
delete_document Delete document
Removes the document folder from disk. Not reversible.
| Parameter | Type | Description |
|---|---|---|
docId * | string |
read_text Read text at a location
The editable text runs at a line:column. Use before write_text to learn the run index and current value.
| Parameter | Type | Description |
|---|---|---|
docId * | string | |
locs * | array | |
prop | string | a path into the element’s attributes for words a component prints from a prop, e.g. `caption` or `columns.2.label` (the `data-od-prop` on the rendered element) |
shown | string | rendered text, disambiguates helper components |
write_text Replace text at a location
Surgical edit of one text run, leaving surrounding markup untouched. Pass `expected` (or `expectedHash`) so a stale write is refused. A run that read_text returned with `segments` (code, emphasis, links) must be written with `segments` too, or it is refused rather than losing its formatting.
| Parameter | Type | Description |
|---|---|---|
docId * | string | |
loc * | object | |
text * | string | |
expected | string | |
expectedHash | string | optional 16-char hash from read_document or read_text; refuses write if file changed |
index | integer | which run, for mixed content |
prop | string | as in read_text |
segments | array | the run as formatted pieces, in order; their texts concatenate to `text` |
add_comment Leave a comment marker
Anchors a @doc-comment note in the source for a later pass to act on, without changing the copy.
| Parameter | Type | Description |
|---|---|---|
docId * | string | |
loc * | object | |
note * | string | |
expectedHash | string | optional 16-char hash from read_document or read_text; refuses write if file changed |
hint | string |
list_themes List themes
House styles available in this workspace.
read_theme Read a theme
The theme document: palette, type scale, page setup, and paste-ready components. Read this before writing a document that declares the theme.
| Parameter | Type | Description |
|---|---|---|
themeId * | string |
list_assets List assets
Images in a scope — a document id, or "global" for the shared directory.
| Parameter | Type | Description |
|---|---|---|
scope | string |
upload_asset Upload an asset
Writes a base64 payload into the scope’s assets directory.
| Parameter | Type | Description |
|---|---|---|
base64 * | string | file contents, base64 encoded |
filename * | string | |
scope * | string |
find_asset_usages Find asset usages
Which documents import an asset. Check this before deleting one.
| Parameter | Type | Description |
|---|---|---|
filename * | string | |
scope * | string |
delete_asset Delete an asset
Removes the file. Run find_asset_usages first.
| Parameter | Type | Description |
|---|---|---|
filename * | string | |
scope * | string |
list_folders List folders
The folder manifest and which document sits in which folder.
create_folder Create folder
Adds a folder to the manifest.
| Parameter | Type | Description |
|---|---|---|
name * | string | |
icon | object | defaults to a grey colour chip |
file_document File a document
Assigns a document to a folder, or unfiles it with folderId: null.
| Parameter | Type | Description |
|---|---|---|
docId * | string | |
folderId * | string | null |
check_layout Check the layout
Renders the document at true page size and reports what is wrong with the sheets — content clipped by the page edge, a blank page, a heading stranded at the foot of a page, unreadable type, an image that failed to load. Findings carry a `loc` (line:column) pointing at the source. Run this after writing or editing a document: it is the only way to see what you actually produced. With `maxPages`, going over is an error and `budget` says how many pages must go and how many each top-level section takes.
| Parameter | Type | Description |
|---|---|---|
docId * | string | |
maxPages | integer | Page limit the document must fit in |
translation_status Translations and what they are behind
Every document that declares `meta.translationOf` (the source document's id) and `meta.translatedAt` (the source commit it matches), with its state: current, stale (the source changed since), unsynced (no translatedAt yet), missing-source, unknown-revision or no-git. Stale ones list the changed source files and commits. Pass `docId` with `diff: true` to get the source's changes as a unified diff — translate only those, then call mark_translated.
| Parameter | Type | Description |
|---|---|---|
diff | boolean | Include the source's unified diff since translatedAt |
docId | string | One translation; omit for all |
mark_translated Mark a translation as up to date
Sets the translation's `meta.translatedAt` to the source's last commit (or `revision`). Call it after the translation has caught up with every change translation_status listed. Refuses while the source has uncommitted changes.
| Parameter | Type | Description |
|---|---|---|
docId * | string | The translation, not the source |
revision | string | Source commit it now matches; defaults to the last one |
proofread_document Proofread the text
Reads the text the document prints and reports consistency slips: full-width letters or digits, punctuation of the wrong width for the document's language, Simplified characters in a Traditional Chinese document (or the reverse), a doubled word, one term capitalised two ways. Each finding has a page, a snippet and a `loc` (line:column). Advice, not errors — fix what is a real slip, leave what is intended. Code is not read.
| Parameter | Type | Description |
|---|---|---|
docId * | string |
render_page Screenshot a page
A PNG of one sheet at true page size, exactly as it prints. Use it when check_layout reports something you need to look at, or to confirm a design change landed.
| Parameter | Type | Description |
|---|---|---|
docId * | string | |
page * | integer | 1-based page number |
export_document Export a document
Writes the document to disk headlessly — pdf, html, one png per page, or docx (structure Word flows itself, for review in Word). The output directory must stay inside the workspace.
| Parameter | Type | Description |
|---|---|---|
docId * | string | |
each | boolean | one copy per row of the document’s `records` — certificates, letters, quotes |
format | string | |
name | string | with each: file name pattern, `{column}` for a value and `{#}` for the row number |
outDir | string | relative to the workspace root; defaults to `out` |
diff_document What changed since a revision
Renders the document as it is and as it was at a git revision (default HEAD), pairs the pages by content, and reports each page as same, changed, added or removed — with the lines of text added and removed and the changed regions. Also writes a self-contained HTML report with before/after pictures for a human reviewer. Use it to summarise your edits before handing a document back, or to answer "what changed since main".
| Parameter | Type | Description |
|---|---|---|
docId * | string | |
outDir | string | relative to the workspace root; defaults to `out` |
since | string | git revision to compare against; defaults to HEAD |
import_markdown Import Markdown
Turns Markdown into a real document under docs/ — flow() body, cover page, local images copied into the document’s assets. Use this instead of hand-writing TSX when the user already has the content written.
| Parameter | Type | Description |
|---|---|---|
author | string | |
contents | boolean | add a self-filling contents page |
cover | boolean | open with a title page; defaults to true |
docId | string | defaults to a slug of the title |
file | string | path to a .md file inside the workspace |
lang | string | BCP 47 tag, e.g. zh-Hant-TW; detected for Chinese, Japanese and Korean when omitted |
markdown | string | the Markdown itself |
orientation | string | |
pageSize | string | |
subtitle | string | |
theme | string | |
title | string |
import_docx Import Word document
Turns a Word .docx file into a real document under docs/ that looks like the Word page: page size and margins, alignment, indents, fonts, sizes, colours, tables with their column widths, merged cells, borders and shading, fill-in blanks, page breaks. Headings in Word heading styles stay real headings. Pass `plain: true` for structure only in the house style (with a cover), like import_markdown. `warnings` lists what Word had that the document could not hold (text boxes, footnotes, comments, tracked changes); tell the user about them.
| Parameter | Type | Description |
|---|---|---|
file * | string | path to a .docx file inside the workspace |
author | string | |
contents | boolean | with plain: add a self-filling contents page |
cover | boolean | with plain: open with a title page; defaults to true |
docId | string | defaults to a slug of the title |
lang | string | BCP 47 tag, e.g. zh-Hant-TW; detected for Chinese, Japanese and Korean when omitted |
orientation | string | |
pageSize | string | |
plain | boolean | structure only in the house style instead of the Word page look |
subtitle | string | |
theme | string | |
title | string |