Repository navigation
feat(app-server): PlantUML and CSV in create_diagram - #116
Conversation
create_diagram takes `plantuml` and `csv` besides `xml` and `mermaid`. The viewer converts them with draw.io's own converters, as Arrange > Insert > Advanced does: PlantUML with drawio-plantuml, loaded from viewer.diagrams.net only when a PlantUML diagram comes in, CSV with the CSV import of the viewer bundle on an offscreen graph. "Open in draw.io" keeps the PlantUML source in the group draw.io makes on insert, and the model gets the converted diagram in its context, as for Mermaid. The server checks what would fail in the viewer (no @start/@EnD lines, a CSV without data lines, the orgchart layout, whose bundle the viewer doesn't load), draws PlantUML passed as xml or mermaid as PlantUML, and gives clients without the app a #create link for CSV. draw.io links can't carry PlantUML, so those clients are asked to redraw it. %column% placeholders in CSV styles work: draw.io's decompression runs decodeURIComponent on the inflated data, which throws "URI malformed" only for CSV compressed without being URL-encoded first. The app server's link encodes first, as the tool server does; the tool server's warning against these placeholders is replaced by that explanation (checked in app.diagrams.net on 2026-11-18). The tool description names the formats in its first line only (2038 of 2048 characters); the new parameters say to use them for source the user gives. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The viewer counts plantuml or csv as given only when its text is more than white space, as the server does (sourceArgument), so a host that sends the unused parameters as "" keeps the XML or Mermaid preview and gets no converter error. A PlantUML or CSV conversion still running when the tool result or endStreaming comes is dropped (sourceRender), so it no longer replaces an error the server returned with the diagram or its own error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
I reviewed the follow-up commit and found no new bugs. This is still a large feature in the viewer, including on-demand loading of the 1.2 MB PlantUML converter from viewer.diagrams.net, so a human should also look at it.
What was reviewed:
sourceArgumentnow counts plantuml/csv only when non-blank. ontoolinput and ontoolinputpartial both use it, which matches the server'strim().length > 0check.- The
sourceRendertoken inrenderSourceDiagramis cleared inendStreamingandontoolresult, so a conversion that finishes late no longer draws over a tool error or a newer result. - Checked the server-side
plantUmlProblem/csvProblemchecks and the#create=CSV fallback link against the new tests inplantuml-csv.test.js. I didn't run the tests.
Extended reasoning...
The change adds PlantUML and CSV formats to create_diagram in mcp-app-server (about 580 lines in shared.js plus a 354-line test file) and updates docs and AGENTS.md files. Its main external surface is loading a remote converter script into the viewer when a PlantUML diagram comes in. It touches no auth or crypto. The follow-up commit 8a94e6c changes the code at both places named in the earlier inline comments. I deferred because of the size of the change and the remote script loading, not because of an open defect.
Brings in #116 (PlantUML and CSV in create_diagram) and #117 (the @drawio/mcp npm entry in server.json, version 1.13.1, and its test). Conflicts, both sides kept: - server.json description: "Mermaid, PlantUML, CSV or XML in, editable draw.io diagrams out, live in chat. 10,000+ shapes." Since #116 the viewer converts PlantUML (drawio-plantuml) and CSV (draw.io's CSV import) into draw.io cells, and this branch makes every Mermaid type come out as cells, so the line is true now and is the one #121 sets. - README comparison table: the app server takes all three and PlantUML (#116); the skill converts Mermaid with draw.io Desktop or an installed Chrome, Edge or Chromium (this branch). - docs/app-server-tools.md: the create_diagram input lists plantuml and csv (#116) with this branch's Mermaid details, followed by #116's PlantUML and CSV paragraph. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in #116 as squash-merged (identical to the two #116 commits already on this branch) and #117 (the @drawio/mcp npm entry in server.json at 1.13.1, its test, the tool server's mcpName). Conflicts, both sides kept: - the files #116 and this branch both changed: this branch's version, since main's #116 is the same as this branch's copy of it - server.json description: this branch's line ("Mermaid, PlantUML, CSV or XML in, editable draw.io diagrams out, live in chat. 10,000+ shapes."), with #117's version and packages entry - mcp-app-server/AGENTS.md key files: this branch's semantic-bundle.js row, #117's server.json row Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
create_diagramin the MCP App Server takes two more formats,plantumlandcsv, besidesxmlandmermaid.What it does
mxPlantUmlToDrawio.parseText), as Arrange > Insert > Advanced > PlantUML does in draw.io; no PlantUML server is involved. The 1.2 MB converter is loaded fromviewer.diagrams.net/js/plantuml/only when a PlantUML diagram comes in (PLANTUML_PATHinlines a local build for the Node server). "Open in draw.io", Copy and Download keep the PlantUML source in the group draw.io makes on insert, so the diagram stays editable as PlantUML.doImportCsv) on an offscreen graph, as Arrange > Insert > Advanced > CSV does.%column%placeholders work in labels and styles,stylePlaceholders=1included; the ELK layouts use the page's ELK.@start…/@end…lines, a CSV without a header and a data line, theorgchartlayout (its bundle isn't loaded by the viewer). PlantUML passed asxmlormermaidis drawn as PlantUML with a note.#create=link of typecsvfor CSV. draw.io links can't carry PlantUML, so those clients are asked to draw it again as Mermaid or XML.The "URI malformed" error with
%column%in CSV stylesdraw.io's
Graph.decompressrunsdecodeURIComponenton the inflated data, which throws "URI malformed" on a raw%fill%only when the CSV was compressed without being URL-encoded first. The app server's link encodes before compressing, as the tool server already does, so the placeholders work. The tool server docs' warning against them is replaced by that explanation (checked in app.diagrams.net).Tests
mcp-app-server/test/plantuml-csv.test.js(server checks, the viewer's helpers, the fallback link);npm testinmcp-app-server(298 pass, 3 skipped, 0 fail) andmcp-tool-server(153 pass).mermaid, an unsupported PlantUML family (error shown), CSV withfillColor=%fill%,stylePlaceholders=1andverticalflow, theorgchartand no-data errors, and XML and Mermaid unchanged.Nothing is deployed; this ships with the next app server release.
🤖 Generated with Claude Code