Why AI-Ready?¶
dartwork-mpl is designed from the ground up to work with AI coding assistants. This page shows the concrete features that make AI-generated plots reliable.
Design rationale: For the philosophy behind these decisions — why thin utilities beat wrappers for AI — see Designed for AI Agents.
Automatic Validation¶
AI-generated plots often have subtle issues invisible in text-only environments: clipped labels, overlapping legends, missing tick marks. dartwork-mpl catches these automatically:
# After creating your figure
issues = dm.validate_figure(fig)
# Returns a list of detected problems:
# - Clipped text outside figure bounds
# - Overlapping elements
# - Inconsistent font sizes
This is especially powerful in autonomous AI pipelines where there’s no human to visually inspect every plot. The validation step acts as a quality gate.
MCP Protocol: Real-Time AI Access¶
The Model Context Protocol (MCP) gives AI assistants live access to dartwork-mpl’s documentation, colors, styles, and validation tools:
Category |
Count |
Examples |
|---|---|---|
Resources |
12 + 3 templated |
Agent entry, policy, anti-patterns, recipes, palette/colors, palette/fonts, styles/list, templates/list, |
Tools |
10 |
Color lookup + mix + family list, code lint (text & JSON), find template, migrate 0.3 code, data validation, GitHub fetch, package info |
Prompts |
2 |
|
Source-of-truth counts derived from
dartwork-mpl-mcp’slist_resources/list_tools/list_promptshandshake. The exact catalog ships insrc/dartwork_mpl/mcp/.
The AI assistant always has the latest, most accurate documentation —
no copy-paste, no stale caches, no hallucinated APIs. Tools like
lint_dartwork_mpl_code catch antipatterns (e.g., figsize=, tight_layout())
automatically, and validate_plot_data ensures data structures are correct
before plotting.
→ For the full list and setup instructions, see MCP Server.
Putting It All Together¶
You say: “Plot the signal response with a red line and save it as SVG for my paper.”
↓
AI reads dartwork-mpl guide via MCP:
Knows to use
dm.style.use('scientific')Knows to use
dm.simple_layout(), nottight_layoutKnows color syntax:
'dc.vivid2'Knows to save with
dm.save_formats()
↓
✨ AI generates correct code on first attempt
🔍
dm.validate_figure()confirms no issues📄 Paper-ready SVG saved
→ Ready to set this up? See AI-Assisted Development for the workflow guide, or jump straight to MCP Server for configuration.