edit_diagram
Add, update, or delete cells in the current draw.io diagram by their unique IDs. Execute multiple operations in one call.
Instructions
Edit the current diagram by ID-based operations (update/add/delete cells).
⚠️ REQUIRED: You MUST call get_diagram BEFORE this tool! This fetches the latest state from the browser including any manual user edits. Skipping get_diagram WILL cause user's changes to be LOST.
Workflow:
Call get_diagram to see current cell IDs and structure
Use the returned XML to construct your edit operations
Call edit_diagram with your operations
Operations:
add: Add a new cell. Provide cell_id (new unique id) and new_xml.
update: Replace an existing cell by its id. Provide cell_id and complete new_xml.
delete: Remove a cell by its id. Only cell_id is needed.
For add/update, new_xml must be a complete mxCell element including mxGeometry.
Example - Add a rectangle: {"operations": [{"operation": "add", "cell_id": "rect-1", "new_xml": "<mxCell id="rect-1" value="Hello" style="rounded=0;" vertex="1" parent="1"><mxGeometry x="100" y="100" width="120" height="60" as="geometry"/>"}]}
Example - Update a cell: {"operations": [{"operation": "update", "cell_id": "3", "new_xml": "<mxCell id="3" value="New Label" style="rounded=1;" vertex="1" parent="1"><mxGeometry x="100" y="100" width="120" height="60" as="geometry"/>"}]}
Example - Delete a cell: {"operations": [{"operation": "delete", "cell_id": "rect-1"}]}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| operations | Yes | Array of operations to apply |