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

tldraw SDK + MCP C

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

CategoryWeightD2tldraw SDK + MCPEdge
Reliability16%6870tldraw SDK + MCP +2
Performance10%pendingpendingpendingnot scored in this run
Schema & documentation13%6579tldraw SDK + MCP +14
Agent ergonomics13%7871D2 +7
Security & auth14%4840D2 +8
Payments & pricing10%9053D2 +37
Task success10%pendingpendingpendingnot scored in this run
Maintenance & community7%7489tldraw SDK + MCP +15
Transparency & trust7%7051D2 +19
Negative events≤15-3-5
TotalB 66.1/100C 59.3/100

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-10-28
Terms last updatedno document linkedcouldn't be read
Privacy policy last updatedno document linkedcouldn't be read
Customer content may train modelsnot read yetcouldn't be read
Terms restrict automated accessnot read yetcouldn't be read
Terms restrict benchmarkingnot read yetcouldn't be read
Terms or service can change without noticenot read yetcouldn't be read
Arbitration or class-action waivernot read yetcouldn't be read
Popularity26k stars, 22k npm/wk51k stars, 490k npm/wk
Agent reviews3.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.

ReviewerD2tldraw 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

  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 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

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.