Element CRUD Tools

Tools for creating, reading, updating, and deleting elements on the canvas.

add_element

Add a new element to the canvas.

Parameters:

Name Type Required Description
type string Yes rect, circle, text, image, line
x number Yes X position
y number Yes Y position
width number Yes Width
height number Yes Height
fillColor string No Fill color hex (default: #4A90D9 for shapes, #000000 for text)
strokeColor string No Stroke color hex
strokeWidth number No Stroke width (default: 0)
cornerRadius number No Corner radius for rectangles
opacity number No Opacity 0.0-1.0 (default: 1.0)
rotation number No Rotation in degrees
text string No Text content (for text elements)
fontSize number No Font size (default: 16)
fontWeight string No regular, light, medium, semibold, bold
textAlignment string No left, center, right
name string No Element name
imageUrl string No Image URL (for image elements)
maskShape string No none, circle, ellipse, roundedRect
x2 number No Line end X
y2 number No Line end Y

Returns: JSON with the created element's full properties

Examples

Rectangle with rounded corners:

{
  "type": "rect",
  "x": 100, "y": 100,
  "width": 400, "height": 300,
  "fillColor": "#3B82F6",
  "cornerRadius": 20
}

Text element:

{
  "type": "text",
  "x": 150, "y": 200,
  "width": 300, "height": 50,
  "text": "Hello World",
  "fontSize": 36,
  "fontWeight": "bold",
  "fillColor": "#FFFFFF",
  "textAlignment": "center"
}

Circle:

{
  "type": "circle",
  "x": 500, "y": 300,
  "width": 200, "height": 200,
  "fillColor": "#EF4444"
}

Image with circle mask:

{
  "type": "image",
  "x": 50, "y": 50,
  "width": 200, "height": 200,
  "imageUrl": "https://example.com/photo.jpg",
  "maskShape": "circle"
}

Line:

{
  "type": "line",
  "x": 100, "y": 500,
  "width": 400, "height": 0,
  "x2": 500, "y2": 500,
  "strokeColor": "#666666",
  "strokeWidth": 2
}

add_image

Add an image element from a URL with optional clip mask.

Parameters:

Name Type Required Description
url string Yes Image URL to download
x number Yes X position
y number Yes Y position
width number Yes Width
height number Yes Height
maskShape string No none, circle, ellipse, roundedRect
cornerRadius number No Corner radius for roundedRect mask
strokeColor string No Border color hex
strokeWidth number No Border width
opacity number No Opacity 0.0-1.0
name string No Element name

list_elements

List all elements on the canvas.

Parameters: None

Returns: JSON with element summaries (id, type, name, position, visibility)

{
  "elements": [
    {
      "id": "uuid-1",
      "type": "rect",
      "name": "Background",
      "x": 0, "y": 0,
      "width": 1080, "height": 1080,
      "visible": true,
      "locked": false
    }
  ],
  "count": 1
}

get_element

Get full properties of a specific element.

Parameters:

Name Type Required Description
id string Yes Element UUID

update_element

Update properties of an existing element. Only specified properties are changed.

Parameters:

Name Type Required Description
id string Yes Element UUID
All other element properties various No Only provided values are updated

Example — change color and position:

{
  "id": "uuid-1",
  "fillColor": "#FF0000",
  "x": 200,
  "y": 150
}

delete_element

Delete an element from the canvas.

Parameters:

Name Type Required Description
id string Yes Element UUID

delete_all_elements

Delete all elements from the canvas.

Parameters: None


duplicate_element

Duplicate an element with optional offset.

Parameters:

Name Type Required Description
id string Yes Element UUID
offsetX number No X offset (default: 20)
offsetY number No Y offset (default: 20)