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 |
8 |
Usage guides, color palettes, font lists, style presets, plot templates |
Tools |
7 |
Color lookup, code linting, data validation, GitHub file fetch |
Prompts |
2 |
Guided plot creation, style compliance review |
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:
'oc.red5'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.