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
| Parameter | Type | Required | Description |
|---|---|---|---|
sketchId | string | No | Target sketch ID. Defaults to the currently active sketch. |
type | string | Yes | Layer type to add (e.g. "shape", "text", "filter", "guide"). |
name | string | No | Display name for the layer. Auto-generated from type if omitted. |
properties | object | No | Type-specific properties for the layer. |
transform | object | No | Position and sizing. Fields: x, y, width, height, rotation, scaleX, scaleY, anchorX, anchorY. |
opacity | number | No | Layer opacity, 0–1. Defaults to 1. |
blendMode | string | No | CSS blend mode. Defaults to "normal". |
index | number | No | Z-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
indexis provided, existing layers at or above that index shift up by one.
Error Cases
| Error | Cause |
|---|---|
SKETCH_NOT_FOUND | The specified sketchId does not exist or no sketch is active. |
INVALID_LAYER_TYPE | The type value is not a recognized layer type. |
INVALID_TRANSFORM | A transform field has an out-of-range or non-numeric value. |
INDEX_OUT_OF_RANGE | The 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
}