d2-mcp-server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@d2-mcp-serverrender a D2 diagram of a simple client-server architecture"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
d2-mcp-server
An MCP (Model Context Protocol) server for the D2 diagram language. Lets LLMs render, validate, and format D2 diagrams without requiring the d2 binary — rendering is powered by the @terrastruct/d2 WASM package.
Tools
Tool | Description | Requires |
| Compile and render D2 source to SVG | No |
| Parse D2 and return a structured text summary of shapes/connections (fast preview, no rendering) | No |
| Check D2 syntax and return errors | No |
| Canonically format D2 source code | Yes |
| List all available themes with IDs | No |
| List available layout engines | No |
Related MCP server: mcp-mermaid-validator
Install the D2 Skill
The repo ships a d2 agent skill that teaches LLMs how to write effective D2 diagrams (syntax, styling, patterns, when to use which layout engine, and how to save output).
Install it via skills.sh:
npx skills add itsjool/d2-mcpThis drops skills/d2/SKILL.md into your agent's skills directory so it's automatically available in any session.
Requirements
Node.js 18+
d2binary only required ford2_format— install from d2lang.com or setD2_PATHenv var
Install
npm install
npm run buildUsage with Claude Code
Via npx (no install required):
{
"mcpServers": {
"d2": {
"command": "npx",
"args": ["-y", "github:itsjool/d2-mcp"]
}
}
}Via local build:
{
"mcpServers": {
"d2": {
"command": "node",
"args": ["/path/to/d2-mcp/dist/index.js"]
}
}
}Then start Claude Code with:
claude --mcp-config /path/to/mcp.jsonDevelopment
npm run dev # watch mode with tsx
npm run build # compile TypeScript to dist/
npm start # run compiled serverNotes
ELK layout is significantly slower than dagre in WASM; prefer dagre unless you specifically need ancestor-to-descendant connections or container sizing
License
MIT
Available Tools
6 toolsd2_formatFormat D2 CodeARead-onlyIdempotent
Format D2 diagram source code using the d2 binary formatter.
Normalizes whitespace, indentation, and syntax to D2's canonical style. The formatted output is semantically equivalent to the input.
NOTE: This tool requires the d2 binary to be installed (unlike d2_render and d2_validate which use WASM). Install from https://d2lang.com or set D2_PATH env var.
Args:
d2_code (string): D2 source code to format
Returns: Formatted D2 source code string.
Examples:
Clean up: format "a->b:label" to "a -> b: label"
Normalize after editing: run on any hand-written D2 code
Error Handling:
Returns error if d2 binary is not found (d2_render still works without it)
Returns error if code has syntax errors (format requires valid syntax)
| Name | Required | Description | Default |
|---|---|---|---|
| d2_code | Yes | The D2 diagram source code to format |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint, idempotentHint, and non-destructive behavior. The description adds valuable context beyond those hints: it normalizes formatting, preserves semantic meaning, requires the d2 binary, and fails if the binary is missing or syntax is invalid. This is consistent with the annotations and gives the agent realistic expectations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well organized with clear sections: purpose, behavior, binary requirement, args, returns, examples, and error handling. Every section contributes useful information and there is no filler. The most important scoping detail (requiring the d2 binary) is front-loaded early.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with one simple parameter, no output schema, and rich annotations, the description fully covers the calling context: what it does, what it returns, when it fails, and how it differs from siblings. Nothing an agent needs to invoke it correctly is missing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100% and the single parameter d2_code is already well described in the schema. The description's Args section repeats the same meaning without adding constraints like minLength or maxLength. Baseline 3 is appropriate because the schema carries the parameter documentation burden.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb and resource: 'Format D2 diagram source code using the d2 binary formatter.' It goes on to state the canonicalization goal and semantic equivalence, and it explicitly contrasts with d2_render and d2_validate regarding the WASM vs binary backend, which differentiates it from siblings.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context for when to use the tool ('Clean up', 'Normalize after editing') and explicitly distinguishes it from siblings by noting the d2 binary requirement, saying 'unlike d2_render and d2_validate which use WASM.' It does not explicitly say 'use d2_validate for validation' but the context is sufficient.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
d2_inspectInspect D2 Diagram StructureARead-onlyIdempotent
Parse and summarize the structure of D2 source code without rendering.
Returns a human-readable text summary of all shapes, containers, connections, and boards (layers/steps/scenarios) in the diagram. Uses the compile step only — no rendering occurs, so this is fast (~100ms) regardless of diagram complexity.
Use this INSTEAD of d2_render(ascii=true) for structural previews. The ASCII renderer has known bugs with cross-container connections and reverse edges. This tool produces reliable output for all diagram types.
Args:
d2_code (string): D2 source code to inspect
Returns: Structured text summary, e.g.: Shapes (4): - cp [rectangle] "Control Plane" - cp.listener [rectangle] "API Gateway" - cp.grpc [rectangle] "gRPC Server" - agent [rectangle] "Data Plane Agent"
Connections (2):
cp.grpc -> agent.stream : "mirror request"
agent.stream -> cp.grpc : "response"Works correctly for all diagram types:
Architecture diagrams with nested containers and cross-container connections
Sequence diagrams (filters out internal lifeline-end nodes)
ER diagrams (sql_table shapes, FK connections shown at table level)
UML class diagrams
Layered/stepped/scenario diagrams (each board summarized)
State machines, flowcharts, grid dashboards
Error handling:
Returns compile errors if D2 code is invalid (same as d2_validate)
| Name | Required | Description | Default |
|---|---|---|---|
| d2_code | Yes | The D2 diagram source code to inspect |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With annotations already declaring readOnly, idempotent, and non-destructive behavior, the description adds meaningful context beyond them: it uses only the compile step (no rendering), is fast (~100ms), filters lifeline-end nodes in sequence diagrams, and returns compile errors. No contradiction exists.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is organized into clear sections (overview, usage guidance, args, return example, supported diagram types, error handling) with no filler. While longer than minimal, every sentence contributes unique information such as example output and type-specific behavior.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a single-parameter tool with no output schema, the description is complete: it defines the input, gives a concrete return example, lists supported diagram types, explains error handling, and covers behavioral nuances. An agent has everything needed to invoke it correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema already documents d2_code with 100% coverage ('The D2 diagram source code to inspect'). The description's Args section repeats the same semantics without adding new detail, so the baseline of 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb phrase ('Parse and summarize the structure of D2 source code without rendering') and clearly states the deliverable: a human-readable summary of shapes, containers, connections, and boards. It explicitly distinguishes itself from d2_render, so an agent can select it correctly.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives direct usage guidance: 'Use this INSTEAD of d2_render(ascii=true) for structural previews' and explains why the alternative is unreliable for cross-container connections and reverse edges. This is explicit, actionable routing information.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
d2_list_layoutsList D2 Layout EnginesARead-onlyIdempotent
List available D2 layout engines with descriptions and feature support.
Use layout names with d2_render's layout parameter. No d2 binary required — layout list is built-in.
Args: (none)
Returns: JSON object: { "layouts": [{ "name": string, "description": string, "features": string[] // Supported features }] }
Layout guidance:
dagre: Default. Fast, good for most flowcharts and architecture diagrams.
elk: Better for complex graphs, supports ancestor-to-descendant connections, width/height on containers. Slower than dagre.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Beyond the annotations (readOnlyHint, idempotentHint, destructiveHint), the description discloses that the layout list is built-in and requires no d2 binary, and it provides the exact JSON return structure. It also gives behavioral context for layout engines (dagre default, elk trade-offs). No contradiction with annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with a clear opening statement, usage note, args section, return schema, and layout guidance. Every section serves a purpose and the most important information is front-loaded. The layout guidance is extra but relevant to selecting a layout.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a parameter-free, read-only listing tool with no output schema, the description is remarkably complete. It covers what the tool does, the exact return format, how to apply the results, and practical details like the absence of a d2 binary requirement.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has zero parameters, and the input schema already declares an empty properties object with additionalProperties false. The description confirms 'Args: (none)' and therefore adds no misleading or ambiguous parameter information. Baseline for 0 params is 4.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The first sentence, 'List available D2 layout engines with descriptions and feature support,' uses a specific verb and resource, immediately distinguishing it from siblings like d2_list_themes and d2_render. The additional note about using layout names with d2_render's layout parameter further reinforces its role.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly tells the agent to use the returned layout names with d2_render's layout parameter, which is actionable guidance. It also notes that no d2 binary is required. However, it does not explicitly name alternatives or state when not to use this tool, though that is less critical for a simple listing tool.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
d2_list_themesList D2 ThemesARead-onlyIdempotent
List all available D2 diagram themes with their IDs and names.
Use theme IDs with d2_render's theme_id parameter. No d2 binary required — theme list is built-in.
Args: (none)
Returns: JSON object: { "light": [{ "id": number, "name": string }], "dark": [{ "id": number, "name": string }] }
Notable themes:
0: Neutral Default (clean, professional — good default)
3: Flagship Terrastruct (vibrant, colorful)
8: Colorblind Clear (accessible palette)
200: Dark Mauve (dark mode)
300: Terminal (monospace, dot-fill containers, uppercase labels)
302: Origami (paper-like aesthetic)
303: C4 (C4 architecture diagram style)
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true, idempotentHint=true, openWorldHint=false, and destructiveHint=false. The description adds meaningful context beyond these by specifying the exact return structure and the fact that the theme list is built-in, plus notable theme examples that help the agent select appropriate values.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured and front-loaded with purpose and usage, followed by a compact return format and a useful list of notable themes. Each section earns its place; the notable themes list adds practical value for choosing theme IDs despite being slightly longer than a minimal description.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With no input parameters and annotations already covering safety and idempotency, the description fully compensates for the lack of an output schema by documenting the exact JSON return shape. It also provides enough theme context for the agent to use the tool correctly and connect its output to d2_render.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has zero parameters, so parameter semantics are mostly non-applicable. The description explicitly says 'Args: (none)' and the input schema confirms an empty properties object, which is fully sufficient. The baseline for zero parameters is 4.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states a specific action ('List all available D2 diagram themes') with a specific resource and expected content (IDs and names). It is easily distinguished from sibling tools like d2_render and d2_list_layouts because it uniquely refers to theme listing and provides the built-in theme ID inventory.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly says theme IDs are meant to be used with d2_render's theme_id parameter, which gives the agent clear downstream usage context. It also notes that no d2 binary is required, clarifying the environmental prerequisite, but it does not explicitly define when-not-to-use or compare against a direct alternative.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
d2_renderRender D2 DiagramARead-onlyIdempotent
Render D2 diagram source code to SVG or ASCII art using the D2 WASM engine.
D2 is a diagram scripting language. This tool compiles and renders D2 code without requiring the d2 binary — it uses the @terrastruct/d2 WASM package directly.
Args:
d2_code (string): D2 source code to render
theme_id (number): Theme ID (default: 0). See d2_list_themes for options. Key themes: 0=Neutral Default, 3=Flagship Terrastruct, 300=Terminal, 200=Dark Mauve
dark_theme_id (number): Dark mode theme ID (optional)
layout ('dagre' | 'elk'): Layout engine (default: 'dagre'). WARNING: elk is extremely slow in WASM — do NOT use unless explicitly requested. Dagre handles all diagram types well.
sketch (boolean): Hand-drawn style (default: false)
pad (number): Padding pixels (default: 100)
center (boolean): Center in viewbox (default: false)
scale (number): Scale factor, e.g. 0.5 halves size. Default fits SVG to screen. Set 1 to disable.
animate_interval (number): Animate multi-board diagrams (layers/scenarios/steps) at this ms interval. Requires target to be set. E.g. animate_interval=1000, target='*'
target (string): Which board to render. '*' = all boards (needs animate_interval > 0). 'layers.x' = specific layer. Default = root board only.
ascii (boolean): Output ASCII art instead of SVG (default: false)
ascii_mode ('standard' | 'extended'): ASCII char set. 'extended' uses Unicode (default).
no_xml_tag (boolean): Omit declaration for direct HTML embedding (default: false)
skip_fonts (boolean): Strip embedded font data from SVG (DEFAULT: true). Only set false if user explicitly requests embedded fonts.
Returns: SVG markup string (or ASCII art if ascii=true). SVG output starts with (unless no_xml_tag=true)
Examples:
Simple: d2_code="a -> b: connects"
Architecture: d2_code="server -> db: query\nserver -> cache: read"
Styled: d2_code="x: { style.fill: '#4a90d9' }\nx -> y", theme_id=3
ASCII preview: d2_code="a -> b -> c", ascii=true
Animated steps: d2_code="steps: { s1: {a} s2: {a -> b} }", animate_interval=1000, target="*"
With embedded fonts: skip_fonts=false (only when user explicitly requests it)
HTML embed: no_xml_tag=true
Error Handling:
Returns error with syntax details if D2 code is invalid
Use d2_validate first to check syntax before rendering
| Name | Required | Description | Default |
|---|---|---|---|
| pad | No | Padding in pixels around the diagram (default: 100) | |
| ascii | No | Render as ASCII/Unicode art instead of SVG (default: false). Useful for terminal display, text-only contexts, and fast structural previews before committing to a full SVG render. | |
| scale | No | Scale factor for the output SVG. E.g. 0.5 halves the size. By default D2 renders SVGs that fit to screen. Set to 1 to disable fit-to-screen. Not applicable to ascii output. | |
| center | No | Center the SVG in its viewbox (default: false) | |
| layout | No | Layout engine: 'dagre' (default, recommended for all diagrams — fast and handles nested containers well). 'elk' is extremely slow in WASM (can take minutes) — do NOT use it unless the user explicitly requests it. | |
| sketch | No | Render in hand-drawn/sketch style (default: false) | |
| target | No | Which board to render. Defaults to root board only. Use '*' to render all layers/scenarios/steps (requires animate_interval > 0 for multi-board). Use 'layers.x.*' to render layer 'x' and all its children. Use 'layers.x' to render only layer 'x'. | |
| d2_code | Yes | The D2 diagram source code to render | |
| theme_id | No | Theme ID (default: 0 = Neutral Default). Use d2_list_themes to see all options. Popular: 300 (Terminal), 200 (Dark Mauve), 3 (Flagship Terrastruct) | |
| ascii_mode | No | ASCII rendering character set. 'standard' uses basic ASCII chars, 'extended' uses Unicode box-drawing chars (default: 'extended'). Only applies when ascii=true. | |
| no_xml_tag | No | Omit the <?xml ...?> declaration from SVG output (default: false). Useful when embedding SVG directly in HTML. | |
| skip_fonts | No | Strip embedded font data from SVG output (default: TRUE). Removes ~500KB of base64 WOFF data — SVG falls back to system fonts which look identical in practice. Only set to false if the user explicitly requests embedded fonts. No effect on ascii output. | |
| dark_theme_id | No | Theme ID to use when the viewer's browser is in dark mode. If unset, theme_id is used for both modes. | |
| force_appendix | No | Always include the SVG appendix for tooltips and links, even if none are present in the diagram (default: false). Useful when you plan to add tooltips/links via post-processing. | |
| animate_interval | No | If set, packages multiple boards (layers/scenarios/steps) into one animated SVG, cycling through boards at this interval in milliseconds. Requires target to be set (e.g. target='*' for all boards). Use with diagrams that define layers/scenarios/steps. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare this a safe, idempotent, read-only operation, but the description adds substantial behavioral context beyond them: the elk performance hazard ('extremely slow in WASM'), the exact output contract (SVG markup starting with <?xml ...?> unless no_xml_tag=true, or ASCII art), the ~500KB font-data implication of skip_fonts, and the multi-board animation semantics of animate_interval/target. It also discloses error behavior ('Returns error with syntax details if D2 code is invalid'). This is rich, decision-relevant behavior disclosure well above the annotation baseline.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with clear sections (overview, Args, Returns, Examples, Error Handling) and front-loads the core purpose in the first sentence. Given 15 parameters and complex multi-board/ASCII/font behaviors, the length is largely justified. However, the Args section re-states each parameter that the 100%-covered schema already documents, creating redundancy that costs agent context; a tighter version could reference the schema and add only the warnings, examples, and return contract.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with no output schema and high complexity (15 params, interactive behavior between animate_interval and target, two output modalities), the description is complete: it specifies the return type and format, the XML declaration condition, error behavior, and the validation workflow. The examples cover the major invocation patterns (simple, styled, ASCII, animated, HTML-embed, embedded-fonts), so an agent has everything needed to call the tool correctly without inspecting further.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the baseline is 3, and the description does add genuine meaning beyond the schema: concrete D2 syntax examples ('a -> b: connects', styled blocks with theme_id=3, steps: { s1: {a} ... }), a compact key for theme IDs (0, 3, 300, 200), and the return-format context for params like no_xml_tag and ascii. Some duplication exists — layout, target, and animate_interval wording largely mirrors the schema — but the examples section teaches correct parameter combinations in a way the schema alone does not.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb+resource+output: 'Render D2 diagram source code to SVG or ASCII art using the D2 WASM engine.' It further clarifies it compiles D2 code without requiring the d2 binary, making the tool's function unambiguous. The rendering action is inherently distinct from siblings like d2_validate, d2_format, and d2_list_themes, so an agent can select it correctly without opening the schema.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives strong when-not guidance: 'elk is extremely slow in WASM — do NOT use unless explicitly requested' and 'skip_fonts ... Only set false if user explicitly requests embedded fonts.' It also routes to a sibling in the Error Handling section: 'Use d2_validate first to check syntax before rendering,' and points to d2_list_themes for theme options. However, it does not systematically contrast with d2_inspect or d2_format (e.g., when to prefer format/inspect over render), leaving some alternative-selection judgment to the agent.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
d2_validateValidate D2 CodeARead-onlyIdempotent
Validate D2 diagram source code for syntax and semantic errors using the WASM engine.
Uses compile step to detect all errors without rendering. No d2 binary required.
Args:
d2_code (string): D2 source code to validate
Returns: JSON object: { "valid": boolean, // Whether the code is syntactically and semantically valid "error": string // Error message if invalid (omitted if valid) }
Examples:
Check before rendering: validate first, then d2_render only if valid=true
Debug syntax: get specific line/column error info
Error Handling:
Returns { valid: false, error: "..." } with specific error details
Never throws — always returns a structured result
| Name | Required | Description | Default |
|---|---|---|---|
| d2_code | Yes | The D2 diagram source code to validate |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already mark it readOnly and idempotent; the description adds meaningful behavior beyond that: uses the WASM engine, performs a compile step, requires no d2 binary, and never throws but always returns a structured result. These details accurately shape agent expectations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well organized with clear sections: purpose, args, returns, examples, and error handling. Every sentence contributes useful information, and the core purpose is front-loaded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a single-parameter validation tool, this description is complete. It covers what the tool does, how it behaves, what it returns, error handling, and practical usage context. The absence of an output schema is compensated by an explicit return shape in the description.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents d2_code fully. The description repeats the parameter but adds no extra semantic detail beyond what the schema provides, such as max length or requiredness.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description states a specific verb ('Validate') and resource ('D2 diagram source code'), clarifies scope ('syntax and semantic errors'), and differentiates from siblings by noting it detects errors via compile step without rendering. This lets an agent distinguish it from d2_render and d2_format.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Provides explicit guidance: 'validate first, then d2_render only if valid=true' and 'Debug syntax: get specific line/column error info.' This tells the agent both when to use the tool and how it fits with sibling tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
6 tool updates
v1.0.0- First observed
d2_format - First observed
d2_inspect - First observed
d2_list_layouts - First observed
d2_list_themes - First observed
d2_render - First observed
d2_validate
TDQS
Each tool targets a distinct stage of the D2 workflow: validate, inspect, format, render, list themes, and list layouts. Even though d2_validate and d2_inspect both compile, their return types and purposes are clearly separated, and the descriptions explicitly guide users to d2_inspect over render-ascii for structural previews.
All tools share the d2_ prefix and use clear imperative verbs, with lookup tools following a consistent list_X pattern. The naming is predictable and makes it easy to infer what each tool does without reading the full description.
Six tools is a well-scoped set for a D2 diagram server: rendering, validation, inspection, formatting, theme listing, and layout listing each serve a distinct need. No tool feels redundant, and nothing essential appears missing for the server's purpose.
The tool set covers the full authoring workflow: validate before rendering, inspect structure without rendering, format source code, and render with configurable themes and layouts. It also exposes theme and layout catalogs so agents can discover valid parameters, leaving no obvious dead ends.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Enable secure connectivity between Sentry issues and debugging data, and LLM clients, using a Model Context Protocol (MCP) server.
A Model Context Protocol server for Wix AI tools
Render, verify, describe, and safely edit Mermaid diagrams through MCP.
Read-only MCP server for the WebAssembly spec: instructions, types, sections, search, proposals.
Related MCP Servers
- AlicenseCqualityFmaintenanceEnables AI agents and assistants like Goose or Claude to interact with VS Code through the Model Context Protocol.763275Apache 2.0
- AlicenseBqualityCmaintenanceA Model Context Protocol server that validates and renders Mermaid diagrams.18856MIT
- AlicenseNot gradedqualityCmaintenanceEnables programmatic control of the WezTerm terminal emulator through the Model Context Protocol. It allows users to manage panes, tabs, and windows while reading terminal content or sending commands directly to the terminal environment.291MIT
- AlicenseCqualityDmaintenanceEnables AI models to create and manage various types of diagrams (flowcharts, UML, network diagrams, etc.) via the Model Context Protocol.26916ISC
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ItsJooL/d2-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server