SuperAPIAI Directory

drawspec

github.com · AI developer platforms

drawspec is a declarative diagram generation tool for language models: users only need to describe the diagram's content (boxes, arrows, labels, and roles) in JSON, without providing coordinates, sizes, or font sizes; the tool automatically computes layout, routing, and color schemes, and outputs clean SVG, PNG, or plain-text diagrams. It supports more than 30 diagram types, including flowcharts, sequence diagrams, state machines, ER diagrams, Gantt charts, mind maps, and more, and provides integration methods such as an MCP server, JSON Schema, AGENTS.md, and Agent Skill, making it easy for LLMs to generate and validate diagrams.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)

About this tool

drawspec is a declarative diagram specification tool whose core goal is to separate "diagram content" from "visual layout." Users (especially language models) only need to describe in JSON what the diagram is meant to convey: which boxes, arrows, and labels exist, and what role each element plays. drawspec is responsible for deciding all positions, sizes, routing, and colors, and outputs clean SVG, PNG, or plain-text diagrams.

Main capabilities:

  • Supports more than 30 diagram types, including flowcharts, tree diagrams, cycle diagrams, stack diagrams, timelines, bar charts, matrices, pyramids, funnel charts, scatter plots, state machines, sequence diagrams, swimlane diagrams, ER diagrams, Gantt charts, kanban boards, fishbone diagrams, Venn diagrams, journey maps, dendrograms, Sankey diagrams, waterfall charts, pie charts, mind maps, argument maps, family trees, network diagrams, railroad diagrams, use case diagrams, Wardley maps, packet diagrams, PERT charts, automata, neural network diagrams, coverage maps, and more.
  • Output formats: SVG (can be inlined into Markdown or HTML, adapts to dark mode and grayscale printing), PNG (supports light, dark, or transparent backgrounds), plain text (supports tabs or ASCII characters, suitable for terminals, commit messages, or code blocks).
  • Theme system: uniformly modify the theme of all diagrams in a project via a TOML file, and themes can also be generated from CSS or design tokens.
  • Readability design: each diagram type has a size budget; when exceeded, it prompts you to split the diagram rather than drawing a dense diagram.

Usage:

  • LLM-oriented integration: provides an MCP server (install drawspec-mcp via pip install 'drawspec[mcp]'), including the list_kinds, get_example, get_schema, validate_document, and render_document tools; provides a single-page format description in AGENTS.md; provides an Agent Skill directory; provides JSON Schema for editor completion and structured output validation. Typical loop: the model selects a diagram type, writes JSON, calls validate_document, fixes errors based on the feedback, and finally renders.
  • Command-line usage: render JSON documents via the drawspec command, with optional output format and character set.

Use cases:

  • Avoid issues such as misaligned coordinates, arrows not pointing correctly, and text overflow when language models generate diagrams.
  • Development or documentation scenarios that require quickly generating clean, themeable, linkable SVG diagrams.linkable SVG diagrams.
  • Display plain-text diagrams in terminals or code blocks.

Limitations:

  • Not a graph layout engine; not suitable for large graphs with hundreds of nodes (Graphviz is recommended).
  • Not a plotting library; chart types only express known numbers, with no statistics, dates, logarithmic scales, or interactive features.
  • Not a drawing program; not suitable for position-centric maps, floor plans, etc.
  • Documentation and examples are generated from code, and tests check for drift.

The project is under the MIT license, with code in src/drawspec/, examples in docs/reference/, and tests in tests/.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools