MCP ToolsDesign Layers
design_reorder_layers
Move a layer to a new z-order position.
Move a layer to a new z-order position. Index 0 is the bottom of the stack (rendered first), and higher indices are closer to the top (rendered last).
Input Schema
| Parameter | Type | Required | Description |
|---|---|---|---|
sketchId | string | No | Target sketch ID. Defaults to the currently active sketch. |
layerId | string | Yes | The ID of the layer to move. |
newIndex | number | Yes | The target z-order index. |
Output Shape
{
"layerId": "layer_a3c4e5",
"name": "Title Text",
"oldIndex": 1,
"newIndex": 0
}Side Effects
- The layer moves to the new position in the z-order.
- Other layers shift to fill the gap and accommodate the insertion.
- The design composite re-renders with the new stacking order.
Error Cases
| Error | Cause |
|---|---|
SKETCH_NOT_FOUND | The specified sketchId does not exist or no sketch is active. |
LAYER_NOT_FOUND | No layer with the given layerId exists in the sketch. |
INDEX_OUT_OF_RANGE | The newIndex is negative or exceeds the layer count minus one. |
Golden Path Example
Request
{
"layerId": "layer_a3c4e5",
"newIndex": 0
}Response
{
"layerId": "layer_a3c4e5",
"name": "Title Text",
"oldIndex": 1,
"newIndex": 0
}