delete_nodes tool removes components from the canvas by their IDs. Each deleted component takes its entire child subtree with it — all nested elements are removed in a single call. The response tells you how many total nodes (including children) were deleted, which is useful for confirming the operation completed as expected.
You can delete multiple components in one call by passing several IDs in the array. This is more efficient than calling delete_nodes repeatedly and reduces the number of round-trips between your agent and the canvas.
Parameters
string[]
required
An array of component IDs to remove from the canvas. Each ID should correspond to a component currently on the canvas. Obtain IDs from
get_tree, get_selection, add_components, or list_artboards. Non-existent IDs are silently ignored.Response
number
required
The total count of nodes removed from the canvas, including all descendants of the targeted components. For example, deleting a
<section> that contains three child <div> elements returns deleted: 4.Example
response