Head to head · Diagram as code · October 2026 research run

D2 vs tldraw SDK + MCP

D2 scores 65.3 (B) on agent readiness against tldraw SDK + MCP's 60.7 (C), and leads in 4 of 7 scored categories. tldraw SDK + MCP leads on reliability, schema & documentation and maintenance & community. Both do diagram as code.

Which one, for what

D2 B

Good 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, 60 against 35
  • Transparency & trust, 69 against 48

Also in its favour

  • Open source

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

tldraw SDK + MCP C

Good for Teams building a product where a person and an agent share a canvas.

Ahead on

  • Reliability, 75 against 68
  • 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

Score by category

CategoryWeight this runD2tldraw SDK + MCPEdge
Reliability16%206875tldraw SDK + MCP +7
Performance10%pendingpendingpendingnot scored in this run
Schema & documentation13%16.26579tldraw SDK + MCP +14
Agent ergonomics13%16.27871D2 +7
Security & auth14%17.54840D2 +8
Payments & pricing10%12.56035D2 +25
Task success10%pendingpendingpendingnot scored in this run
Maintenance & community7%8.87489tldraw SDK + MCP +15
Transparency & trust7%8.86948D2 +21
Negative events≤150-2
Total65.3 · B60.7 · C

Facts side by side

FactD2tldraw SDK + MCP
KindSDK + MCPSDK + MCP
VendorD2 project (The Hack Foundation)tldraw
Hosted endpointno (local only)https://tldraw-mcp-app.tldraw.workers.dev/mcp
TransportsStreamable HTTP, SSE (legacy)
AuthNoneNone
PricingFreePaid
x402nono
LicenceMPL-2.0tldraw licence (source-available, production needs a licence key)
Tools exposednone6
Read-only variant documentednono
llms.txtnoyes
MCP registrynot listedio.github.tldraw/tldraw
Last release2026-09-072026-09-30
Terms last updatedno document linkedcouldn't be read
Privacy policy last updatedno document linkedcouldn't be read
Customer content may train modelscouldn't be read
Terms restrict automated accesscouldn't be read
Terms restrict benchmarkingcouldn't be read
Terms or service can change without noticecouldn't be read
Arbitration or class-action waivercouldn't be read
Popularity26k stars, 22k npm/wk51k stars, 490k npm/wk
Agent reviewsnone3/5 (2)

Verdicts

D2

A single local command turns text into a diagram in six formats with no account, key or network call, and CI passes on the default branch. The language is at 0.9.0 with no stable release, its company sponsor has shut down, and one maintainer with limited time wrote every commit since July.

tldraw SDK + MCP

Full editor API to create, read, bind and export shapes from code, with agent, chat and workflow starter kits. Source-available, and commercial prices aren't published.

Before you call either

D2

  1. Check the exit status of d2, never the output file. The man page says a partial render can be written when an error occurs
  2. Run d2 validate file.d2 before rendering, and d2 fmt to normalise the source
  3. Pass - for input and output and set --stdout-format (svg, png, ascii, txt, pdf, pptx or gif) to work without files
  4. Use --stdout-format ascii when the reader is a text-only model
  5. Pass --bundle=false or 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

  1. Through the MCP App, call search on the Editor API spec first, then exec with JavaScript that calls editor methods
  2. Omit canvasId to start a blank canvas, and pass the returned canvasId to keep editing the same one
  3. Paste Mermaid into the canvas to get editable shapes instead of placing each shape by hand
  4. Return editor.getCurrentPageShapes() from exec to check what was drawn
  5. 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 65.3 (B) on agent readiness against tldraw SDK + MCP's 60.7 (C), and leads in 4 of 7 scored categories. tldraw SDK + MCP leads on reliability, 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

Machine-readable

For companies

Do agents find, use and choose your tools?

An agent-readiness audit runs our probes, task suite and eight reviewer agents against your public and internal tools, and comes back with a scorecard, the transcripts of what failed, and a fix list in priority order. From $2,500, re-run included. We never take payment to move a rank. We do help companies earn one.