genart.dev
MCP ToolsDesign Layers

design_add_layer

Add a new design layer of a given type to the active sketch.

Add a new design layer of a given type to the active sketch. The layer is inserted at the top of the stack by default, or at a specific index if provided.

Input Schema

ParameterTypeRequiredDescription
sketchIdstringNoTarget sketch ID. Defaults to the currently active sketch.
typestringYesLayer type to add (e.g. "shape", "text", "filter", "guide").
namestringNoDisplay name for the layer. Auto-generated from type if omitted.
propertiesobjectNoType-specific properties for the layer.
transformobjectNoPosition and sizing. Fields: x, y, width, height, rotation, scaleX, scaleY, anchorX, anchorY.
opacitynumberNoLayer opacity, 01. Defaults to 1.
blendModestringNoCSS blend mode. Defaults to "normal".
indexnumberNoZ-order index to insert at. Defaults to top of stack.

Output Shape

{
  "layerId": "layer_a1b2c3",
  "name": "Shape 1",
  "type": "shape",
  "index": 2
}

Side Effects

  • A new layer is created and rendered in the design composite.
  • The layer list in the UI updates to reflect the addition.
  • If index is provided, existing layers at or above that index shift up by one.

Error Cases

ErrorCause
SKETCH_NOT_FOUNDThe specified sketchId does not exist or no sketch is active.
INVALID_LAYER_TYPEThe type value is not a recognized layer type.
INVALID_TRANSFORMA transform field has an out-of-range or non-numeric value.
INDEX_OUT_OF_RANGEThe index exceeds the current layer count.

Golden Path Example

Request

{
  "type": "shape",
  "name": "Background Circle",
  "properties": {
    "shape": "ellipse",
    "fill": "#2a4365"
  },
  "transform": {
    "x": 400,
    "y": 300,
    "width": 500,
    "height": 500
  },
  "opacity": 0.85,
  "blendMode": "multiply"
}

Response

{
  "layerId": "layer_f7e2d1",
  "name": "Background Circle",
  "type": "shape",
  "index": 0
}