edit_drawio_svg
Modify an existing .drawio.svg diagram by adding, removing, or updating nodes, edges, and groups, keeping current positions or recomputing layout with ELK.
Instructions
Edit an existing .drawio.svg file by adding, removing, or updating nodes, edges, and groups. Use numeric IDs from read_drawio_svg to reference existing elements (e.g. remove_nodes: ["15"], update_nodes: [{id: "15", ...}]). For add operations, use temporary IDs to establish relationships within the same call (e.g. add_nodes: [{id: "new", ...}], add_edges: [{source: "15", target: "new"}]). By default (layout_mode: "preserve"), existing node and group positions are kept exactly as-is; only newly added elements are placed automatically outside the existing layout. Use layout_mode: "recompute" to fully recompute layout with ELK. Icons of existing (unchanged) nodes are preserved automatically — no need to pass icon data. To replace an icon on an existing node, use update_nodes with icon_path. Removing a group does not delete its child nodes — they become top-level nodes. All add/update operations support style_overrides for CSS-equivalent per-element visual customization: add_nodes/update_nodes (fill_color=background-color, stroke_color=border-color, stroke_width=border-width, stroke_dashed=border-style:dashed, font_bold=font-weight:bold, font_size=font-size, font_color=color, opacity=opacity, rounded=border-radius, shadow=box-shadow, text_align=text-align, etc.); add_edges/update_edges (stroke_color, stroke_width, stroke_dashed, font_color, font_size, opacity, etc.); add_groups/update_groups (fill_color, stroke_color, stroke_width, stroke_dashed, rounded, corner_radius=border-radius%, font_color, font_size, font_bold, opacity, text_align, shadow, etc.). update_edges also supports label, style (solid/dashed), connector, and arrow changes — identified by source+target pair. style_overrides from read_drawio_svg can be passed back to preserve or selectively override existing styles. IMPORTANT: style_overrides in update_nodes/update_edges/update_groups are MERGED with existing styles — only specified properties are changed, unspecified properties are preserved. You do NOT need to re-specify all existing style_overrides when making a partial update.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"file_path": "<file_path>"
},
"name": "edit_drawio_svg"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| layout | No | Optional layout options. Applies to recompute mode; spacing also used for new-element placement in preserve mode. | |
| add_edges | No | Edges to add. | |
| add_nodes | No | Nodes to add to the diagram. | |
| file_path | Yes | Absolute path to the .drawio.svg file to edit. | |
| add_groups | No | Groups to add. | |
| layout_mode | No | "preserve" (default): keep existing node/group positions exactly; place only new elements outside. "recompute": fully recompute layout with ELK (ignores existing positions). | |
| remove_edges | No | Edges to remove, identified by source+target pair. | |
| remove_nodes | No | IDs of nodes to remove. All edges touching these nodes are also removed. | |
| update_edges | No | Update label, style, connector, arrow, or visual style of existing edges, identified by source+target pair. style_overrides are merged with existing styles. | |
| update_nodes | No | Update label, highlight, icon, or style of existing nodes. | |
| remove_groups | No | IDs of groups to remove. Child nodes are NOT deleted — they become top-level. | |
| update_groups | No | Update label, style, children, or visual style of existing groups. |