Why AI-Ready?¶
Part of AI & Agent-Assisted Plotting — the hub covering the 30-second setup, IDE compatibility matrix, prompt corpus, and plot templates.
dartwork-mpl is designed from the ground up to work with AI coding assistants. This page is the runnable, in-depth version of the hub’s Why agents work well here cards — each section below is a concrete, copy-paste example of one feature that makes 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 |
10 + 4 templated |
Agent entry, policy, anti-patterns, recipes, migration, palette/colors, palette/fonts, styles/list, templates/list, |
Tools |
16 |
Color lookup + mix + family list, code lint (text & JSON) + auto-fix, find template, render template (basic + advanced tiers), validate generated plot, suggest chart type from data, compose layered plot, 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.red2'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.