genart.dev
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

ParameterTypeRequiredDescription
sketchIdstringNoTarget sketch ID. Defaults to the currently active sketch.
layerIdstringYesThe ID of the layer to move.
newIndexnumberYesThe 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

ErrorCause
SKETCH_NOT_FOUNDThe specified sketchId does not exist or no sketch is active.
LAYER_NOT_FOUNDNo layer with the given layerId exists in the sketch.
INDEX_OUT_OF_RANGEThe 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
}