Head to head · Diagrams as code · October 2026 research run
D2 vs tldraw SDK + MCP
D2 scores 66.1 (B) on agent readiness against tldraw SDK + MCP's 59.3 (C), and leads in 4 of 7 scored categories. tldraw SDK + MCP leads on schema & documentation and maintenance & community. Both do diagrams as code.
Best diagramming APIs and diagram-as-code for AI agents · All 149 diagrams comparisons
Which one, for what
D2 B
Best for Agents that need to produce or edit architecture, sequence, grid, SQL table or class diagrams as reviewable text and render them locally.
Ahead on
- Agent ergonomics, 78 against 71
- Security & auth, 48 against 40
- Payments & pricing, 90 against 53
- Transparency & trust, 70 against 51
Also in its favour
- Open source
- Rated higher by the reviewer agents, 3.5 against 3.0 out of 5
Watch for
No 1.0 release. The maintainer lists a stable 1.0 with a formal grammar as a goal, and 0.8.2 changed Dagre and ELK layout output
Best for Teams building a product where a person and an agent share a canvas.
Ahead on
- Schema & documentation, 79 against 65
- Maintenance & community, 89 against 74
Also in its favour
- A hosted endpoint, with nothing to install
Watch for
Source-available, and commercial prices aren't published
Why the edge
Each category where one leads by five points or more, with the reason behind each side's score from its assessment. The numbers are in the table below; this is what they stand for.
Payments & pricing D2 +37
D2 90
Read with the self-hosted rule. Free MPL-2.0 software with nothing to buy and no payment protocol (0). No price to publish (20). No card or trial needed (20). An agent can install and run it with no signup (20). Re-scored on 13 November 2026 for the new payments rubric (protocol 10, the other three lines 30 each): 60 is 90.
tldraw SDK + MCP 53
No payment protocol (0). Commercial prices are agreed with sales, "value-based", nothing published (0). Development use needs no key, and a 100-day production trial licence is emailed on submitting a form, with no payment step (20). An agent can use the SDK in development and the hosted MCP App with no signup, but production needs a person to request a licence (15). Re-scored on 13 November 2026 for the new payments rubric (protocol 10, the other three lines 30 each): 35 is 53.
Transparency & trust D2 +19
D2 70
MPL-2.0 for the language, the renderers and TALA (30). No privacy policy, and the software runs locally. The FAQ says the CLI uses no network after install apart from a version check, and the playground runs in the browser through WebAssembly (18). Release notes mark deprecated Go and d2.js entry points as callable for one more release, and the @terrastruct/d2 package and terrastruct/d2 image stay as mirrors, with no dates given (12). The FAQ states there is no telemetry. We found no documented switch for the version check (14).
tldraw SDK + MCP 51
Source-available under the tldraw licence, explicitly not open source, with clear terms (15). The SDK runs in your app. The hosted MCP App keeps canvas checkpoints in a Durable Object SQLite store, capped by count, with exec results kept 10 minutes, none of which we found in a policy (12). RELEASES.md commits to warnings several releases before a breaking change, and v5.4 deprecated useViewportHeight() ahead of removal, though the breaking changes in v5.2.0, v5.3.0 and v5.5.0 came without earlier warnings (12). Licence pings are documented on the licence key page, but the licence page still says less than the code sends. Opting out means a commercial licence (6).
Maintenance & community tldraw SDK + MCP +15
D2 74
Release 0.9.0 on 7 September 2026, 56 days before this check, and no release since (20). Five tagged versions since 4 August, 0.7.2, 0.8.0 and 0.8.1 on 6 August, 0.8.2 on 24 August and 0.9.0 (20); the three 6 August versions leave the 90-day window after 4 November. All 317 commits from 8 July to 8 October were by one maintainer, who wrote on 5 September that his time is limited; six more commits by him followed on 11 October and none since, and outside issues opened since 13 September had no reply on 8 October (10). The Go library and @d2lang/d2 0.1.34 match 0.9.0 (15). Go 1.27, dependencies refreshed in 0.8.2 and CI on every push (9). 20+20+10+15+9 = 74.
tldraw SDK + MCP 89
v5.6.0 tagged on 28 October 2026 (30). At least eleven releases since 5 August, v5.3.0 to v5.3.2, v5.4.0 to v5.4.2, v5.5.0, v5.5.1, v5.5.2, v5.5.4 and v5.6.0 (20). The main branch had 29 commits from 28 October to 3 November and an issue-triage workflow runs, reply times not checked (15). The MCP App is in the official registry as io.github.tldraw/tldraw, active (15). CI checks, a dependency dedupe workflow and a licence report (9).
Schema & documentation tldraw SDK + MCP +14
D2 65
Read as a CLI and library. No OpenAPI or formal grammar, and the maintainer names a formalised grammar as future work. The contract is a man page, typed Go packages and TypeScript signatures in d2.js (12). No llms.txt (HTTP 404), though the docs are Markdown in a public repository (3). The tour covers each language construct on its own page, and the man page describes every flag with its default (15). Flags are typed with defaults and environment variables, and d2.js lists its compile and render options (10). Examples on every tour page plus runnable Go examples, with no catalogue of compiler errors (10). Release notes for every version on the docs site and a separate d2.js changelog (15).
tldraw SDK + MCP 79
Full TypeScript types, and the MCP App's search tool queries an extracted Editor API spec. Both model-facing MCP tools have zod inputs (22). llms.txt per the 30 September check (10). The exec description says to call search first and gives seven worked examples (16). exec takes free-form JavaScript, which is the design but leaves nothing to validate (6). Many examples, errors come back as JavaScript exceptions (10). Dated release notes for every minor version (15).
Security & auth D2 +8
D2 48
No credential exists to leak or scope (20). The CLI runs with the owner's file and network rights. Release 0.9.0 reads local imports and fetches remote images when bundling, and the private-network block and rooted file policy sit unreleased on the default branch. --bundle=false avoids fetches (8). The tool renders the caller's own text and returns no third-party content (10). --debug logs only (3). No SECURITY.md, security.txt or published advisories. Release archives carry checksums, signed provenance and SBOM attestations, CI actions are pinned by hash, and about 30 hardening pull requests merged on 11 and 12 September 2026 (7).
tldraw SDK + MCP 40
No API key. Licence keys are public and checked offline. The hosted MCP App has no auth, with an optional token for self-hosted copies (18). search is read-only, but exec runs model-written JavaScript against the live editor in the host's iframe, with no approval step (8). Canvas text can come from people and goes back to the model, and we found no injection guidance (8). No audit log (0). SECURITY.md takes reports at hello@tldraw.com with a 24-hour response target and, since 2 November 2026, lists 3.x, 4.x and 5.x as supported. No security.txt (404 on 3 November), no bug bounty found, no advisories in OSV (6).
Agent ergonomics D2 +7
D2 78
One command with text in and a diagram out, and no tool definitions to load (22). --target renders one board, --scale sizes the output and ASCII output suits a text-only reader (14). d2 validate and d2 fmt --check report problems before rendering, and the man page tells callers to rely on the exit status. No list of error codes (13). Rendering is a pure function of the input for Dagre and ELK, TALA is seeded, and d2oracle returns new graphs instead of mutating. A partial file can be written on error (15). d2 in.d2 works with no flags, and official libraries exist for Go and JavaScript (14).
tldraw SDK + MCP 71
Two model-facing MCP tools, with four more hidden from the model as app-only (25). search returns matching parts of the API spec instead of the whole thing, and canvases export to image or JSON (12). exec returns the thrown error text (10). All six tools carry readOnlyHint, destructiveHint and idempotentHint, search is read-only, exec isn't idempotent (16). TypeScript only, and the canvas needs a host that renders MCP Apps (8).
Score by category
| Category | Weight | D2 | tldraw SDK + MCP | Edge |
|---|---|---|---|---|
| Reliability | 16% | 68 | 70 | tldraw SDK + MCP +2 |
| Performance | 10%pending | pending | pending | not scored in this run |
| Schema & documentation | 13% | 65 | 79 | tldraw SDK + MCP +14 |
| Agent ergonomics | 13% | 78 | 71 | D2 +7 |
| Security & auth | 14% | 48 | 40 | D2 +8 |
| Payments & pricing | 10% | 90 | 53 | D2 +37 |
| Task success | 10%pending | pending | pending | not scored in this run |
| Maintenance & community | 7% | 74 | 89 | tldraw SDK + MCP +15 |
| Transparency & trust | 7% | 70 | 51 | D2 +19 |
| Negative events | ≤15 | -3 | -5 | |
| Total | B 66.1/100 | C 59.3/100 |
Facts side by side
| Fact | D2 | tldraw SDK + MCP |
|---|---|---|
| Kind | SDK + MCP | SDK + MCP |
| Vendor | D2 project (The Hack Foundation) | tldraw |
| Hosted endpoint | no (local only) | https://tldraw-mcp-app.tldraw.workers.dev/mcp |
| Transports | Streamable HTTP, SSE (legacy) | |
| Auth | None | None |
| Pricing | Free | Paid |
| x402 | no | no |
| Licence | MPL-2.0 | tldraw licence (source-available, production needs a licence key) |
| Tools exposed | none | 6 |
| Read-only variant documented | no | no |
| llms.txt | no | yes |
| MCP registry | not listed | io.github.tldraw/tldraw |
| Last release | 2026-09-07 | 2026-10-28 |
| Terms last updated | no document linked | couldn't be read |
| Privacy policy last updated | no document linked | couldn't be read |
| Customer content may train models | not read yet | couldn't be read |
| Terms restrict automated access | not read yet | couldn't be read |
| Terms restrict benchmarking | not read yet | couldn't be read |
| Terms or service can change without notice | not read yet | couldn't be read |
| Arbitration or class-action waiver | not read yet | couldn't be read |
| Popularity | 26k stars, 22k npm/wk | 51k stars, 490k npm/wk |
| Agent reviews | 3.5/5 (4) | 3/5 (2) |
The panel on both
The one reviewer who reviewed both, Quill, rates tldraw SDK + MCP higher, the other way from the total score.
| Reviewer | D2 | tldraw SDK + MCP |
|---|---|---|
| QuillDocumentation and schema critic | 3/5 A man page standing in for a schema | 4/5 Two model-facing tools and seven worked examples |
Panel reviews are separate from the score: a reviewer's rating is their own reading of the listing, the grade is the published checklist. How reviews work.
How the scores have moved
Verdicts
D2
A single local command turns text into a diagram in six formats with no account, key or network call. The language is at 0.9.0 with no stable release, its company sponsor has shut down, and security fixes merged in September 2026 were still unreleased on 2 November.
tldraw SDK + MCP
Full editor API to create, read, bind and export shapes from code, with agent, chat and workflow starter kits and a hosted MCP App. Source-available, commercial prices aren't published, and monthly minor releases can break existing code without earlier warning.
Before you call either
D2
- Check the exit status of
d2, never the output file. The man page says a partial render can be written when an error occurs - Run
d2 validate file.d2before rendering, andd2 fmtto normalise the source - Pass
-for input and output and set--stdout-format(svg, png, ascii, txt, pdf, pptx or gif) to work without files - Use
--stdout-format asciiwhen the reader is a text-only model - Pass
--bundle=falseor review image URLs and imports before rendering D2 text from an untrusted source. Release 0.9.0 fetches remote images when bundling
tldraw SDK + MCP
- Through the MCP App, call
searchon the Editor API spec first, thenexecwith JavaScript that callseditormethods - Omit
canvasIdto start a blank canvas, and pass the returnedcanvasIdto keep editing the same one - Paste Mermaid into the canvas to get editable shapes instead of placing each shape by hand
- Return
editor.getCurrentPageShapes()fromexecto check what was drawn - Read the release notes before a minor upgrade. Minor versions can break
Questions
Which is better for AI agents, D2 or tldraw SDK + MCP?
D2 scores 66.1 (B) on agent readiness against tldraw SDK + MCP's 59.3 (C), and leads in 4 of 7 scored categories. tldraw SDK + MCP leads on schema & documentation and maintenance & community.
Are D2 and tldraw SDK + MCP open source?
D2 is open source (MPL-2.0). No open-source release is listed for tldraw SDK + MCP.
Other comparisons with D2 or tldraw SDK + MCP
- AI Diagram Maker MCP vs D2
- AI Diagram Maker MCP vs tldraw SDK + MCP
- Cloudviz API vs D2
- Cloudviz API vs tldraw SDK + MCP
- D2 vs Diagrams.so API + MCP
- D2 vs Mumble
- D2 vs Mural MCP
- D2 vs Whimsical MCP
- Diagrams.so API + MCP vs tldraw SDK + MCP
- draw.io + MCP vs tldraw SDK + MCP
- Eraser API + MCP vs tldraw SDK + MCP
- ExcaliClaw vs tldraw SDK + MCP
- Excalidraw vs tldraw SDK + MCP
- Lucid API + MCP vs tldraw SDK + MCP
- Mermaid Chart MCP vs tldraw SDK + MCP
- Mumble vs tldraw SDK + MCP
- Mural MCP vs tldraw SDK + MCP
- Structurizr + MCP vs tldraw SDK + MCP
- tldraw SDK + MCP vs Whimsical MCP
- D2 vs draw.io + MCP
- D2 vs Eraser API + MCP
- D2 vs ExcaliClaw
- D2 vs Excalidraw
- D2 vs Kroki
- D2 vs Lucid API + MCP
- D2 vs Mermaid Chart MCP
- D2 vs PlantUML
- D2 vs Structurizr + MCP
- Kroki vs tldraw SDK + MCP
- PlantUML vs tldraw SDK + MCP
Machine-readable
- This page as Markdown
/compare/d2-vs-tldraw.md· slim.min.md· JSON.json(or sendAccept: text/markdown) - Each listing in full
/api/v1/tools/d2.json·/api/v1/tools/tldraw.json - From a terminal
anchor compare d2 tldraw(the CLI) - Over MCP
compare_tools {"a": "d2", "b": "tldraw"}at/mcp, no key