@documonster/mcp 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/README.md +170 -51
  2. package/dist/capabilities.d.ts.map +1 -1
  3. package/dist/capabilities.js +28 -0
  4. package/dist/capabilities.js.map +1 -1
  5. package/dist/config.d.ts +1 -1
  6. package/dist/config.d.ts.map +1 -1
  7. package/dist/config.js +10 -2
  8. package/dist/config.js.map +1 -1
  9. package/dist/tools/diagram-inspect.d.ts +20 -0
  10. package/dist/tools/diagram-inspect.d.ts.map +1 -0
  11. package/dist/tools/diagram-inspect.js +91 -0
  12. package/dist/tools/diagram-inspect.js.map +1 -0
  13. package/dist/tools/diagram-markdown.d.ts +45 -0
  14. package/dist/tools/diagram-markdown.d.ts.map +1 -0
  15. package/dist/tools/diagram-markdown.js +127 -0
  16. package/dist/tools/diagram-markdown.js.map +1 -0
  17. package/dist/tools/diagram-render.d.ts +14 -0
  18. package/dist/tools/diagram-render.d.ts.map +1 -0
  19. package/dist/tools/diagram-render.js +117 -0
  20. package/dist/tools/diagram-render.js.map +1 -0
  21. package/dist/tools/diagram.d.ts +217 -0
  22. package/dist/tools/diagram.d.ts.map +1 -0
  23. package/dist/tools/diagram.js +760 -0
  24. package/dist/tools/diagram.js.map +1 -0
  25. package/dist/tools/doc-convert.d.ts.map +1 -1
  26. package/dist/tools/doc-convert.js +26 -4
  27. package/dist/tools/doc-convert.js.map +1 -1
  28. package/dist/tools/doc-read.d.ts.map +1 -1
  29. package/dist/tools/doc-read.js +32 -4
  30. package/dist/tools/doc-read.js.map +1 -1
  31. package/dist/tools/doc-write.d.ts.map +1 -1
  32. package/dist/tools/doc-write.js +21 -3
  33. package/dist/tools/doc-write.js.map +1 -1
  34. package/dist/tools/document.d.ts +1 -1
  35. package/dist/tools/document.d.ts.map +1 -1
  36. package/dist/tools/document.js +13 -1
  37. package/dist/tools/document.js.map +1 -1
  38. package/dist/tools/help.d.ts +263 -15
  39. package/dist/tools/help.d.ts.map +1 -1
  40. package/dist/tools/help.js +263 -15
  41. package/dist/tools/help.js.map +1 -1
  42. package/dist/tools/image.d.ts +147 -0
  43. package/dist/tools/image.d.ts.map +1 -0
  44. package/dist/tools/image.js +749 -0
  45. package/dist/tools/image.js.map +1 -0
  46. package/dist/tools/index.d.ts.map +1 -1
  47. package/dist/tools/index.js +4 -0
  48. package/dist/tools/index.js.map +1 -1
  49. package/dist/tools/inspect.d.ts.map +1 -1
  50. package/dist/tools/inspect.js +98 -6
  51. package/dist/tools/inspect.js.map +1 -1
  52. package/dist/tools/pdf-edit.d.ts +13 -6
  53. package/dist/tools/pdf-edit.d.ts.map +1 -1
  54. package/dist/tools/pdf-edit.js +93 -8
  55. package/dist/tools/pdf-edit.js.map +1 -1
  56. package/dist/tools/sheet-edit.d.ts.map +1 -1
  57. package/dist/tools/sheet-edit.js +37 -2
  58. package/dist/tools/sheet-edit.js.map +1 -1
  59. package/dist/tools/sheet-image.d.ts +58 -0
  60. package/dist/tools/sheet-image.d.ts.map +1 -0
  61. package/dist/tools/sheet-image.js +156 -0
  62. package/dist/tools/sheet-image.js.map +1 -0
  63. package/dist/tools/sheet-read.d.ts.map +1 -1
  64. package/dist/tools/sheet-read.js +18 -1
  65. package/dist/tools/sheet-read.js.map +1 -1
  66. package/dist/tools/sheet-write.d.ts.map +1 -1
  67. package/dist/tools/sheet-write.js +41 -4
  68. package/dist/tools/sheet-write.js.map +1 -1
  69. package/dist/tools/template.d.ts +19 -0
  70. package/dist/tools/template.d.ts.map +1 -1
  71. package/dist/tools/template.js +436 -11
  72. package/dist/tools/template.js.map +1 -1
  73. package/package.json +3 -3
package/README.md CHANGED
@@ -2,12 +2,13 @@
2
2
 
3
3
  [Model Context Protocol](https://modelcontextprotocol.io) server for
4
4
  [documonster](https://github.com/documonster/documonster). Gives an AI assistant
5
- the ability to read, write and convert Excel, Word, PDF, CSV and ZIP documents
6
- on the local filesystem.
5
+ the ability to read, write and convert Excel, Word, PDF, CSV and ZIP documents
6
+ and to draw Mermaid diagrams — on the local filesystem.
7
7
 
8
- > **Status: usable.** Nineteen tools cover spreadsheets, Word, PDF, templates and
9
- > archives — reading, writing, editing, searching and converting. See
10
- > [Roadmap](#roadmap) for what is deliberately absent.
8
+ > **Status: usable.** Twenty-one tools cover spreadsheets, Word, PDF, templates,
9
+ > archives and diagrams — reading, writing, editing, searching, converting and
10
+ > drawing. See [Deliberately absent](#deliberately-absent) for the intentional
11
+ > scope boundaries.
11
12
 
12
13
  ## Install
13
14
 
@@ -61,15 +62,15 @@ No install needed — point your MCP client at `npx`.
61
62
 
62
63
  ## Options
63
64
 
64
- | Flag | Default | Meaning |
65
- | ------------------------- | ------------ | ----------------------------------------------------------------------------------------------------- |
66
- | `--root <dir>` | cwd | Sandbox root. Every path a tool touches must resolve inside it. |
67
- | `--output-root <dir>` | private temp | Separate writable root. Outputs are returned as `@output/<path>` for later calls. |
68
- | `--allow-in-place` | off | Permit edits below `--root`; disabled by default because it weakens isolation. |
69
- | `--readonly` | off | Withhold every mutating tool from the model's tool list. |
70
- | `--enable <groups>` | all | Comma-separated tool groups: `core`, `excel`, `word`, `pdf`, `forms`, `archive`. `core` is always on. |
71
- | `--max-file-size <bytes>` | 67108864 | Reject larger input documents. |
72
- | `--max-output-chars <n>` | 40000 | Truncate tool output — a token budget in disguise. |
65
+ | Flag | Default | Meaning |
66
+ | ------------------------- | ------------ | ---------------------------------------------------------------------------------------------------------------- |
67
+ | `--root <dir>` | cwd | Sandbox root. Every path a tool touches must resolve inside it. |
68
+ | `--output-root <dir>` | private temp | Separate writable root. Outputs are returned as `@output/<path>` for later calls. |
69
+ | `--allow-in-place` | off | Permit edits below `--root`; disabled by default because it weakens isolation. |
70
+ | `--readonly` | off | Withhold every mutating tool from the model's tool list. |
71
+ | `--enable <groups>` | all | Comma-separated tool groups: `core`, `excel`, `word`, `pdf`, `forms`, `archive`, `diagram`. `core` is always on. |
72
+ | `--max-file-size <bytes>` | 67108864 | Reject larger input documents. |
73
+ | `--max-output-chars <n>` | 40000 | Truncate tool output — a token budget in disguise. |
73
74
 
74
75
  ## Security
75
76
 
@@ -114,31 +115,34 @@ server root with an untrusted local account or process while the server runs.
114
115
 
115
116
  ## Tools
116
117
 
117
- | Tool | Purpose |
118
- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
119
- | **Orientation** | |
120
- | `documonster_help` | Conventions, path rules, and formula/document/editing notes kept out of tool schemas to save context. |
121
- | `doc_inspect` | Identify a file (type, size, sheet list, CSV dialect, extension mismatches) or list a directory. Always first. |
122
- | **Spreadsheets** | |
123
- | `sheet_read` | Read a bounded window as a Markdown table with column letters and row numbers. Paginates; reports what it omitted. |
124
- | `sheet_write` | Create an `.xlsx` from a declarative spec. `fromCsv` pulls source data in server-side. |
125
- | `sheet_edit` | Patch an existing `.xlsx` — cells, ranges, formulas, rows, styles, sheets. Atomic, backed up, `dryRun` available. |
126
- | `formula_evaluate` | Evaluate a formula against supplied values using the real engine (~450 functions). Touches no files. |
127
- | **Documents** | |
128
- | `doc_read` | Read `.docx` / `.pdf` / `.md` / `.txt`. Word returns Markdown; PDFs are reported page by page. |
129
- | `doc_write` | Create a `.docx` or `.pdf` from Markdown. |
130
- | `doc_edit` | Find and replace text in a `.docx`, including matches Word split across runs. Formatting preserved. |
131
- | `doc_search` | Find text, or find text **by its formatting** — "which text is red", "what is highlighted". |
132
- | `doc_paginate` | Real page count and per-heading page numbers without Word installed; optionally refresh fields and the TOC. |
133
- | `doc_convert` | `docx`→`md`/`html`/`pdf`/`txt`, `md`→`docx`/`pdf`, `xlsx`→`csv`/`pdf`, `csv`→`xlsx`. Lossy conversions state their loss. |
134
- | `pdf_edit` | Watermark, page numbers, stamps, rotate, delete/keep pages, append another PDF. Overlays never rewrite the original content. |
135
- | **Forms and templates** | |
136
- | `template_inspect` | List a template's placeholders and print the JSON shape needed to fill it. |
137
- | `template_fill` | Fill a Word template from JSON. A missing field fails loudly rather than shipping a blank. |
138
- | `form_fill` | List or fill Word form fields and PDF AcroForms. PDF values are verified by re-reading the saved file. |
139
- | **Archives** | |
140
- | `archive_read` | List or extract a `.zip`/`.tar`. Guards traversal, decompression bombs and symlink entries. |
141
- | `archive_write` | Package files and directories into a `.zip`/`.tar`, verified by reading it back. |
118
+ | Tool | Purpose |
119
+ | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
120
+ | **Orientation** | |
121
+ | `documonster_help` | Conventions, path rules, and formula/document/editing notes kept out of tool schemas to save context. |
122
+ | `doc_inspect` | Identify a file (type, size, sheet list, CSV dialect, extension mismatches) or list a directory. Always first. |
123
+ | **Spreadsheets** | |
124
+ | `sheet_read` | Read a bounded window as a Markdown table with column letters and row numbers. Paginates; reports what it omitted. |
125
+ | `sheet_write` | Create an `.xlsx` from a declarative spec. `fromCsv` pulls source data in server-side; `images` places pictures. |
126
+ | `sheet_edit` | Patch an existing `.xlsx` — cells, ranges, formulas, rows, styles, sheets, images. Atomic, backed up, `dryRun` available. |
127
+ | `formula_evaluate` | Evaluate a formula against supplied values using the real engine (~450 functions). Touches no files. |
128
+ | **Documents** | |
129
+ | `doc_read` | Read `.docx` / `.pdf` / `.md` / `.txt` / `.mmd`. Word returns Markdown; PDFs page by page; a Markdown file's mermaid fences are indexed. |
130
+ | `doc_write` | Create a `.docx` or `.pdf` from Markdown. |
131
+ | `doc_edit` | Find and replace text in a `.docx`, including matches Word split across runs. Formatting preserved. |
132
+ | `doc_search` | Find text, or find text **by its formatting** — "which text is red", "what is highlighted". |
133
+ | `doc_paginate` | Real page count and per-heading page numbers without Word installed; optionally refresh fields and the TOC. |
134
+ | `doc_convert` | `docx`→`md`/`html`/`pdf`/`txt`, `md`→`docx`/`pdf`, `xlsx`→`csv`/`pdf`, `csv`→`xlsx`. Lossy conversions state their loss. |
135
+ | `pdf_edit` | Watermark, page numbers, stamps, a Mermaid diagram drawn as vectors, rotate, delete/keep pages, append another PDF. Overlays never rewrite the original content. |
136
+ | **Forms and templates** | |
137
+ | `template_inspect` | List a template's placeholders and print the JSON shape needed to fill it. |
138
+ | `template_fill` | Fill a Word template from JSON, plus `{{%name}}` image placeholders. A missing field fails loudly rather than shipping a blank. |
139
+ | `form_fill` | List or fill Word form fields and PDF AcroForms. PDF values are verified by re-reading the saved file. |
140
+ | **Diagrams** | |
141
+ | `diagram_inspect` | Parse Mermaid text and report what it means — every node, edge, participant, task or slice recognised. Writes nothing. |
142
+ | `diagram_render` | Draw it as `.svg` / `.png` / `.pdf`. Twenty-one diagram types, themed, from one display list. |
143
+ | **Archives** | |
144
+ | `archive_read` | List or extract a `.zip`/`.tar`. Guards traversal, decompression bombs and symlink entries. |
145
+ | `archive_write` | Package files and directories into a `.zip`/`.tar`, verified by reading it back. |
142
146
 
143
147
  ### Two worked examples
144
148
 
@@ -172,13 +176,124 @@ Note what does **not** happen in either: no document bytes and no bulk rows pass
172
176
  through the model's context. `fromCsv`, the `entries` filter and template data
173
177
  keep the payload on the server.
174
178
 
179
+ ### Diagrams
180
+
181
+ `diagram_render` takes Mermaid text and draws `flowchart`, `sequenceDiagram`,
182
+ `classDiagram`, `stateDiagram`, `erDiagram`, `gantt`, `gitGraph`, `mindmap`,
183
+ `timeline`, `journey`, `kanban`, `quadrantChart`, `xychart`, `radar`, `sankey`,
184
+ `packet`, `block`, `pie`, `C4`, `requirementDiagram` and `architecture` — the same
185
+ twenty-one the core library draws, since this is a thin consumer of its public API.
186
+
187
+ ```jsonc
188
+ diagram_inspect { "source": "flowchart TD\n A[Read] --> B{Valid?}\n B -->|no| A" }
189
+ diagram_render { "source": "…", "to": "arch.svg", "theme": "dark" }
190
+ ```
191
+
192
+ **The result reports the parsed structure, and that is the point.** This is the one
193
+ place in the server where reading the output back is impossible — nothing can look
194
+ at a picture. So both tools answer with what the parser recognised: `3 node(s),
195
+ 3 edge(s)`, `A (Read)`, `B -[no]-> A`. The parser implements a subset of Mermaid and
196
+ a subset fails by _silently dropping_ what it did not understand, so a missing edge
197
+ in that list is the only symptom there will ever be.
198
+
199
+ SVG, PNG and PDF come from the **same display list** rather than three renderers, so
200
+ they are the same picture and not three that might disagree. `theme` picks a colour
201
+ set (`default` is Mermaid's own base theme token for token; `dark` and `neutral` are
202
+ this server's), `themeOverrides` sets individual tokens, and `background` defaults to
203
+ white — a transparent PNG is invisible in a dark viewer, which is a failure the model
204
+ would never see.
205
+
206
+ A ` ```mermaid ` fence in the Markdown you give `doc_write` (or in a `.md` file you
207
+ pass to `doc_convert`) becomes a real embedded image, scaled to fit the text column:
208
+ Word does not shrink an oversized inline image, it runs it off the page. A fence that
209
+ fails to parse is left as a code block and reported, so one bad diagram never costs
210
+ you the document. `diagrams: false` opts out.
211
+
212
+ **Onto a PDF that already exists**, `pdf_edit` takes `{ op: "diagram", source, pages }`
213
+ and draws **vectors** onto the page — sharp at any zoom, saved as an incremental
214
+ update so bookmarks, form fields and signature bytes survive. Two defaults invert
215
+ because it draws _over_ existing content: `background` is transparent, and omitting
216
+ the position centres the diagram at its natural size shrunk to fit, so the simplest
217
+ call lands on the page rather than off the edge of it.
218
+
219
+ **Reading** is the one direction that stays textual, deliberately: `doc_read` cannot
220
+ show you a picture, so it returns a `.mmd` file's source and _indexes_ a Markdown
221
+ file's fences instead. The footer names `diagram_render({ from, index, to })` — the
222
+ point being that the model never has to copy a diagram's source out through its own
223
+ reply in order to draw it.
224
+
225
+ ### Images
226
+
227
+ A diagram is not a separate kind of thing from a picture, so it is not a separate
228
+ argument. Four destinations take an image, and all four take the **same source
229
+ shape**, routed by extension rather than by a format flag:
230
+
231
+ ````jsonc
232
+ { "from": "logo.png" } // .png / .jpg / .gif — embedded as-is
233
+ { "from": "flow.mmd" } // a diagram file — drawn server-side
234
+ { "from": "design.md", "index": 2 } // a ```mermaid fence out of Markdown
235
+ { "source": "flowchart LR\n A --> B" } // Mermaid text
236
+ ````
237
+
238
+ | Destination | How |
239
+ | ----------------------------- | ------------------------------------------------------------ |
240
+ | a worksheet | `images` in `sheet_write`, `op: "add_image"` in `sheet_edit` |
241
+ | a Word template's `{{%name}}` | `images` in `template_fill` |
242
+ | a page of an existing PDF | `op: "diagram"` in `pdf_edit` |
243
+ | a document you write | a ` ```mermaid ` fence in `doc_write`'s Markdown |
244
+
245
+ ```jsonc
246
+ sheet_write { "path": "out/report.xlsx", "sheets": [{ "name": "June",
247
+ "images": [{ "at": "F2", "from": "logo.png" },
248
+ { "at": "A10:H30", "source": "flowchart LR\n A --> B" }] }] }
249
+ template_fill { "template": "invoice.docx", "out": "out/INV.docx",
250
+ "data": { "client": "Acme" },
251
+ "images": { "logo": { "from": "logo.png" } } }
252
+ ```
253
+
254
+ Four details are worth knowing, because each was a real defect before it was a rule.
255
+ **A worksheet anchor means two different things**: a single cell (`"F2"`) hangs the
256
+ picture at its own size, a range (`"A10:H30"`) binds it to those cells so it moves
257
+ _and resizes_ with them — offering only one silently answers half the requests
258
+ wrongly. **One dimension implies the other**, keeping the aspect ratio, because an
259
+ image squashed to a ratio nobody asked for is a defect the model cannot see. **A
260
+ declared resolution is honoured** — a PNG's `pHYs`, a JPEG's JFIF density — because
261
+ Word and Excel honour it, so ignoring it placed a 300-dpi photograph at three times
262
+ its intended size. And **a header that will not parse is an error**, not a 1×1
263
+ placement: the library's own reader answers 1×1 for an unreadable file, which is right
264
+ for a renderer that must draw something and wrong here, where the result would be
265
+ invisible and unreportable.
266
+
267
+ Sizes are in points. A single call may place 20 pictures, 64 MiB of source and 80
268
+ million decoded pixels; the budget is aggregate, because twenty images each just under
269
+ a per-file limit cost the same memory as one enormous one.
270
+
175
271
  ### Deliberately absent
176
272
 
177
273
  Not implemented, and the server tells the model to say so rather than improvise:
178
274
  password-protected files, PDF→Word (no faithful conversion exists), OCR, legacy
179
- binary `.doc`/`.xls`, and image/pivot-table insertion — the library supports
180
- those, no tool does yet. Spreadsheet charts are supported by `sheet_write` and
181
- `sheet_edit`.
275
+ binary `.doc`/`.xls`, and pivot tables — the library supports that last one, no
276
+ tool does yet.
277
+
278
+ A Word template's `{{%name}}` must sit in **a paragraph of its own** — in the body, a
279
+ table cell, or a header or footer, nesting included. One placement is genuinely
280
+ impossible: scoped to a `{{#each}}` item, because images are substituted before loops
281
+ expand, so one picture per row is not expressible. `template_fill` refuses that up
282
+ front and `template_inspect` marks it rather than inventing a key for it.
283
+
284
+ Every image is also checked for **integrity**, not just for a readable header: PNG
285
+ chunk CRCs and an inflate that yields exactly the declared scanlines, a JPEG's
286
+ end-of-image marker, a GIF's trailer. Truncation is how images really arrive broken,
287
+ and a header check cannot see it — the first bytes of a cut-off PNG are identical to a
288
+ whole one's.
289
+
290
+ Because that same pass runs before conditionals are evaluated, a picture inside a
291
+ `{{#if}}` that turns out false is substituted and then removed with its block. The
292
+ fill still succeeds, so `template_fill` reports it as **not in the output** and drops
293
+ its bytes from the package — a document that withholds a picture must not leak it to
294
+ anyone who unzips the file. Every placed picture is then verified by re-opening the
295
+ written `.docx`, because the document handed to the writer is not evidence about the
296
+ file it produced.
182
297
 
183
298
  ### Editing existing files
184
299
 
@@ -206,10 +321,10 @@ Besides tools, the server publishes:
206
321
 
207
322
  - **Resources** — every help topic at `documonster://help/{topic}`, so a client can
208
323
  display them and a model can read one without spending a tool call.
209
- - **Prompts** — five workflow templates (`summarise-spreadsheet`, `build-report`,
210
- `fill-document`, `review-changes`, `convert-document`). Each encodes the working
211
- order that matters — inspect, read narrowly, verify — and tells the model never
212
- to invent a value it was not given.
324
+ - **Prompts** — six workflow templates (`summarise-spreadsheet`, `build-report`,
325
+ `fill-document`, `review-changes`, `convert-document`, `draw-diagram`). Each
326
+ encodes the working order that matters — inspect, read narrowly, verify — and
327
+ tells the model never to invent a value it was not given.
213
328
 
214
329
  ## Programmatic use
215
330
 
@@ -239,11 +354,15 @@ ever imports `@excel/*`, `@utils/*` or reaches into `../../src`.
239
354
 
240
355
  ### Testing layers
241
356
 
242
- | Layer | File | Catches |
243
- | ---------- | ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
244
- | Unit | `config` / `sandbox` / `result` / `errors` / `registry` | Argument parsing, path containment, output budget, error text, tool filtering |
245
- | Protocol | `server.test.ts` | Handshake, `tools/list`, JSON Schema generation, `tools/call`, in-memory transport |
246
- | Executable | `stdio.e2e.test.ts` | Real spawned process: `bin` entry, shebang, exit codes, manifest version, and that stdout carries nothing but JSON-RPC |
357
+ | Layer | File | Catches |
358
+ | ---------- | ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
359
+ | Unit | `config` / `sandbox` / `result` / `errors` / `registry` | Argument parsing, path containment, output budget, error text, tool filtering |
360
+ | Per-kind | `diagram.test.ts` | All 21 diagram types through inspect + SVG + PNG + PDF — a structural summary reading a field one kind spells differently |
361
+ | Units | `image.test.ts` | px-at-96 / pt-at-72 / EMU-at-914400 confusions, by asserting a known pixel size survives into a worksheet anchor |
362
+ | Package | `image.test.ts` | Media integrity in the produced OOXML: unique parts, resolvable relationships, and no bytes left behind by a false `{{#if}}` |
363
+ | Budget | `schema-budget.test.ts` | The permanent context cost of `tools/list`, which nothing else makes visible as it grows |
364
+ | Protocol | `server.test.ts` | Handshake, `tools/list`, JSON Schema generation, `tools/call`, in-memory transport |
365
+ | Executable | `stdio.e2e.test.ts` | Real spawned process: `bin` entry, shebang, exit codes, manifest version, and that stdout carries nothing but JSON-RPC |
247
366
 
248
367
  The e2e suite compiles the package itself in `beforeAll`, so it never
249
368
  silently skips when `dist/` is absent.
@@ -1 +1 @@
1
- {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAMhD,4CAA4C;AAC5C,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAezD;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAgL7E"}
1
+ {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAMhD,4CAA4C;AAC5C,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAezD;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAiN7E"}
@@ -160,6 +160,34 @@ Work in this order:
160
160
  ]
161
161
  }));
162
162
  }
163
+ if (has("diagram") && !config.readonly) {
164
+ server.registerPrompt("draw-diagram", {
165
+ title: "Draw a diagram",
166
+ description: "Turn a description of a system or process into a rendered Mermaid diagram.",
167
+ argsSchema: {
168
+ subject: z.string().describe("What the diagram should show."),
169
+ out: z.string().describe("Output path; the extension picks .svg, .png or .pdf.")
170
+ }
171
+ }, ({ subject, out }) => ({
172
+ messages: [
173
+ {
174
+ role: "user",
175
+ content: {
176
+ type: "text",
177
+ text: `Draw ${out} showing: ${subject}
178
+
179
+ Work in this order:
180
+ 1. Choose the diagram type that matches the *relationship*, not the one you know best — a flow is a flowchart, an interaction over time is a sequenceDiagram, a lifecycle is a stateDiagram, a data model is an erDiagram, a schedule is a gantt.
181
+ 2. Call diagram_inspect with the Mermaid source before rendering. Read the structure it reports back and check every node and edge you intended is there — the parser drops what it does not recognise **silently**, and this is the only place that shows.
182
+ 3. Then diagram_render to ${out}.
183
+ 4. Tell me the diagram's type and its node/edge counts. You cannot see the picture, so do not claim it "looks good" — report what the parser found.
184
+
185
+ If a label is long, prefer shortening it over widening the diagram. If ${out} is a page inside an existing PDF instead of a new file, use pdf_edit with op: "diagram".`
186
+ }
187
+ }
188
+ ]
189
+ }));
190
+ }
163
191
  if ((has("word") || has("pdf") || has("excel")) && !config.readonly) {
164
192
  server.registerPrompt("convert-document", {
165
193
  title: "Convert a document",
@@ -1 +1 @@
1
- {"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,kCAAkC;AAClC,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAE9C,4CAA4C;AAC5C,MAAM,UAAU,iBAAiB,CAAC,MAAiB;IACjD,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;QACxD,MAAM,CAAC,gBAAgB,CACrB,QAAQ,IAAI,EAAE,EACd,GAAG,eAAe,GAAG,IAAI,EAAE,EAC3B;YACE,KAAK,EAAE,gBAAgB,IAAI,EAAE;YAC7B,WAAW,EAAE,KAAK,CAAC,OAAO;YAC1B,QAAQ,EAAE,eAAe;SAC1B,EACD,GAAG,CAAC,EAAE,CAAC,CAAC;YACN,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;SAC3E,CAAC,CACH,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,MAAiB,EAAE,MAAoB;IACrE,MAAM,GAAG,GAAG,CAAC,KAAqD,EAAW,EAAE,CAC7E,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAE3B,IAAI,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;QACjB,MAAM,CAAC,cAAc,CACnB,uBAAuB,EACvB;YAC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AAW,IAAI,OAAO,EAAE;;;;2DAIe;qBAC9C;iBACF;aACF;SACF,CAAC,CACH,CAAC;IACJ,CAAC;AACH,CAAC"}
package/dist/config.d.ts CHANGED
@@ -14,7 +14,7 @@
14
14
  * `core` (`documonster_help`, `doc_inspect`) is always enabled — it is how a
15
15
  * model orients itself before doing anything else.
16
16
  */
17
- export declare const TOOL_GROUPS: readonly ["core", "excel", "word", "pdf", "forms", "archive"];
17
+ export declare const TOOL_GROUPS: readonly ["core", "excel", "word", "pdf", "forms", "archive", "diagram"];
18
18
  export type ToolGroup = (typeof TOOL_GROUPS)[number];
19
19
  export interface ServerConfig {
20
20
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,YAAI,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,CAAU,CAAC;AAEzF,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAerD,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,+EAA+E;IAC/E,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,6EAA6E;IAC7E,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,mDAAmD;IACnD,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACxC,0DAA0D;IAC1D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,wDAAwD;IACxD,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED,qBAAa,WAAY,SAAQ,KAAK;IACpC,SAAkB,IAAI,iBAAiB;CAC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,SAAkB,IAAI,iBAAiB;CACxC;AAED,MAAM,WAAW,oBAAoB;IACnC,gDAAgD;IAChD,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,GAAE,oBAAyB,GACjC,YAAY,CAuEd;AAUD,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAK1F;AA2CD,+BAA+B;AAC/B,wBAAgB,KAAK,IAAI,MAAM,CAkC9B"}
package/dist/config.js CHANGED
@@ -18,9 +18,17 @@ import { parseArgs } from "node:util";
18
18
  * `core` (`documonster_help`, `doc_inspect`) is always enabled — it is how a
19
19
  * model orients itself before doing anything else.
20
20
  */
21
- export const TOOL_GROUPS = ["core", "excel", "word", "pdf", "forms", "archive"];
21
+ export const TOOL_GROUPS = ["core", "excel", "word", "pdf", "forms", "archive", "diagram"];
22
22
  /** Groups enabled when `--enable` is omitted. */
23
- const DEFAULT_GROUPS = ["core", "excel", "word", "pdf", "forms", "archive"];
23
+ const DEFAULT_GROUPS = [
24
+ "core",
25
+ "excel",
26
+ "word",
27
+ "pdf",
28
+ "forms",
29
+ "archive",
30
+ "diagram"
31
+ ];
24
32
  /** Default ceiling for a single input document, in bytes (64 MiB). */
25
33
  const DEFAULT_MAX_FILE_SIZE = 64 * 1024 * 1024;
26
34
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;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,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,WAAW,IAAI,CAAC,EAAE,CAAC;QACvD,MAAM,IAAI,WAAW,CAAC,GAAG,IAAI,qCAAqC,GAAG,GAAG,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,+BAA+B;AAC/B,MAAM,UAAU,KAAK;IACnB,OAAO;;;;;;;;;;;;;;;uCAe8B,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;;wEAEW,qBAAqB;+DAC9B,wBAAwB;;;;;;;;;;;;;;CActF,CAAC;AACF,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * `diagram_inspect` — parse a Mermaid diagram and report what it says, without
3
+ * writing anything.
4
+ *
5
+ * Exists because of an asymmetry the rest of this server does not have: for a
6
+ * spreadsheet the model can read back the cells it wrote, but a diagram's output
7
+ * is a picture it cannot look at. So the read-back has to happen on the *input*
8
+ * side — parse the source, and say which nodes, edges, participants, tasks or
9
+ * slices the parser actually recognised.
10
+ *
11
+ * That matters more than a syntax check. The parser implements a subset of
12
+ * Mermaid, and a subset fails by silently omitting what it did not understand: a
13
+ * mistyped arrow produces one fewer edge rather than an error. Counting them is
14
+ * the only way that is visible.
15
+ *
16
+ * Read-only, so it stays available under `--readonly` — where `diagram_render` is
17
+ * withheld and this is the only diagram capability left.
18
+ */
19
+ export declare const diagramInspectTool: import("./types.js").AnyToolDefinition;
20
+ //# sourceMappingURL=diagram-inspect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagram-inspect.d.ts","sourceRoot":"","sources":["../../src/tools/diagram-inspect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAcH,eAAO,MAAM,kBAAkB,wCA2E7B,CAAC"}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * `diagram_inspect` — parse a Mermaid diagram and report what it says, without
3
+ * writing anything.
4
+ *
5
+ * Exists because of an asymmetry the rest of this server does not have: for a
6
+ * spreadsheet the model can read back the cells it wrote, but a diagram's output
7
+ * is a picture it cannot look at. So the read-back has to happen on the *input*
8
+ * side — parse the source, and say which nodes, edges, participants, tasks or
9
+ * slices the parser actually recognised.
10
+ *
11
+ * That matters more than a syntax check. The parser implements a subset of
12
+ * Mermaid, and a subset fails by silently omitting what it did not understand: a
13
+ * mistyped arrow produces one fewer edge rather than an error. Counting them is
14
+ * the only way that is visible.
15
+ *
16
+ * Read-only, so it stays available under `--readonly` — where `diagram_render` is
17
+ * withheld and this is the only diagram capability left.
18
+ */
19
+ import { z } from "zod";
20
+ import { buildDrawList, describeDiagram, parseDiagram, resolveDiagramSource, toRenderOptions } from "./diagram.js";
21
+ import { textResult } from "./result.js";
22
+ import { defineTool } from "./types.js";
23
+ export const diagramInspectTool = defineTool({
24
+ name: "diagram_inspect",
25
+ group: "diagram",
26
+ title: "Inspect a Mermaid diagram",
27
+ description: "Parse Mermaid text and report what it means: diagram type, and every node/edge/participant/task/slice the parser recognised, plus the size it would render at. Writes nothing. Call this to check a diagram before rendering it, or to find out why a rendered diagram is missing something — an unrecognised statement is dropped silently, and its absence here is the only sign.",
28
+ inputSchema: {
29
+ source: z
30
+ .string()
31
+ .optional()
32
+ .describe("Mermaid diagram text. Use this or `from`, not both. A ```mermaid wrapper is stripped for you."),
33
+ from: z
34
+ .string()
35
+ .optional()
36
+ .describe("Inspect a file instead: a .mmd/.mermaid file, or a .md file — in which case every ```mermaid fence is listed and one is described."),
37
+ index: z
38
+ .number()
39
+ .int()
40
+ .positive()
41
+ .optional()
42
+ .describe("Which fence to describe when `from` is a Markdown file with several. 1-based, defaults to 1.")
43
+ },
44
+ annotations: { readOnlyHint: true, openWorldHint: false },
45
+ mutates: false,
46
+ handler: async (args, context) => {
47
+ const { config } = context;
48
+ const resolved = await resolveDiagramSource(config, args);
49
+ const diagram = parseDiagram(resolved.source);
50
+ // Laid out at the defaults, because the size is the one fact a caller cannot
51
+ // work out from the source and it decides whether a diagram is page-shaped.
52
+ const list = buildDrawList(resolved.source, toRenderOptions({}));
53
+ const lines = [
54
+ resolved.origin === "inline"
55
+ ? "Parsed the diagram you supplied."
56
+ : `Parsed **${resolved.origin}**.`
57
+ ];
58
+ if (resolved.fences.length > 1) {
59
+ lines.push("", `## ${resolved.fences.length} mermaid fences`, "", "| index | line | type | first line |", "| --- | --- | --- | --- |", ...resolved.fences.map(fence => {
60
+ const kind = fenceKind(fence.source);
61
+ const first = fence.source.split("\n")[0]?.trim() ?? "";
62
+ return `| ${fence.ordinal}${fence.ordinal === resolved.selected ? " ←" : ""} | ${fence.line} | ${kind} | \`${first.slice(0, 40)}\` |`;
63
+ }), "", `Fence ${resolved.selected} is described below; pass \`index\` to describe another.`);
64
+ }
65
+ lines.push("", "## Structure", "", ...describeDiagram(diagram), `- renders at ${round(list.width)}×${round(list.height)} points at the default font and spacing`, "", "Compare that against what you intended before rendering. Anything the parser did", "not recognise is simply absent from the list above — it is not reported as an error.");
66
+ return textResult(config, lines.join("\n"));
67
+ }
68
+ });
69
+ /**
70
+ * Name a fence's diagram type without failing the whole call on a broken one.
71
+ *
72
+ * The listing exists to help a caller choose an index, and one malformed fence in
73
+ * a long document must not stop the other nine from being nameable.
74
+ */
75
+ function fenceKind(source) {
76
+ try {
77
+ return parseDiagram(source).kind;
78
+ }
79
+ catch {
80
+ const first = source
81
+ .split("\n")
82
+ .find(line => line.trim().length > 0)
83
+ ?.trim() ?? "";
84
+ const named = first.split(/\s+/)[0] ?? "";
85
+ return named.length === 0 ? "**empty**" : `**unsupported** (${named})`;
86
+ }
87
+ }
88
+ function round(value) {
89
+ return Math.round(value * 10) / 10;
90
+ }
91
+ //# sourceMappingURL=diagram-inspect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagram-inspect.js","sourceRoot":"","sources":["../../src/tools/diagram-inspect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OA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G;AACH,SAAS,SAAS,CAAC,MAAc;IAC/B,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;IACnC,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,KAAK,GACT,MAAM;aACH,KAAK,CAAC,IAAI,CAAC;aACX,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;YACrC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QACnB,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC1C,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,oBAAoB,KAAK,GAAG,CAAC;IACzE,CAAC;AACH,CAAC;AAED,SAAS,KAAK,CAAC,KAAa;IAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC;AACrC,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Mermaid fences inside Markdown, for `doc_write` and `doc_convert`.
3
+ *
4
+ * A ` ```mermaid ` fence carried into a Word document as monospace text is
5
+ * useless — the whole point of the fence is that it is a picture. So each one is
6
+ * rendered to a PNG and spliced in as an inline image before the Markdown reaches
7
+ * the converter.
8
+ *
9
+ * The seam is `markdownToDocx`'s `resolveImage` callback: the fence is rewritten
10
+ * to `![alt](documonster-diagram:N)` and the callback answers that one URL scheme
11
+ * and nothing else. Rewriting to a *file* path instead would need a writable
12
+ * scratch directory and would leak the diagrams as loose files beside the
13
+ * document; going through the callback keeps them in memory and inside the
14
+ * package.
15
+ *
16
+ * The width cap is not cosmetic. A flowchart is routinely wider than a page's text
17
+ * column, and Word does not shrink an oversized inline image — it runs off the
18
+ * edge of the paper. Fitting to the text width is the difference between a
19
+ * document and a broken one.
20
+ */
21
+ import type { MarkdownImportOptions } from "documonster/word/markdown";
22
+ import { type DiagramStyleArgs } from "./diagram.js";
23
+ export interface PreparedMarkdown {
24
+ /** The Markdown with every mermaid fence replaced by an image reference. */
25
+ readonly markdown: string;
26
+ /**
27
+ * Pass as `markdownToDocx`'s `resolveImage`. Present only when at least one
28
+ * fence was rendered, so the no-diagram path behaves exactly as before.
29
+ */
30
+ readonly resolveImage?: MarkdownImportOptions["resolveImage"];
31
+ /** How many diagrams were rendered. */
32
+ readonly count: number;
33
+ /** Lines worth reporting to the caller. */
34
+ readonly notes: readonly string[];
35
+ }
36
+ /**
37
+ * Render every mermaid fence in `markdown` and rewrite it as an inline image.
38
+ *
39
+ * A fence that does not parse is left exactly as it was — a code block — and
40
+ * reported. Failing the whole document because one diagram is malformed would
41
+ * throw away the nine paragraphs that were fine, and the note names the line to
42
+ * fix.
43
+ */
44
+ export declare function prepareMarkdownDiagrams(markdown: string, style?: DiagramStyleArgs): Promise<PreparedMarkdown>;
45
+ //# sourceMappingURL=diagram-markdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagram-markdown.d.ts","sourceRoot":"","sources":["../../src/tools/diagram-markdown.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAqB,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAG1F,OAAO,EAOL,KAAK,gBAAgB,EACtB,MAAM,cAAc,CAAC;AAwBtB,MAAM,WAAW,gBAAgB;IAC/B,4EAA4E;IAC5E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,qBAAqB,CAAC,cAAc,CAAC,CAAC;IAC9D,uCAAuC;IACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,2CAA2C;IAC3C,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAED;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,MAAM,EAChB,KAAK,GAAE,gBAAqB,GAC3B,OAAO,CAAC,gBAAgB,CAAC,CA2E3B"}