Skip to content

MCP: edit operations

shape.add

Adds a rectangle, rounded rectangle or ellipse to a visual track.

Last updated:

Adds a shape item with the given size in pixels before scale. Colours are hex or a template colour name like "$accent"; radius is for rounded_rect only. x and y default to the frame centre.

Arguments#

ArgumentTypeRequiredNotes
durationstringyesA length of at least 1 frame.
fillstringnoA colour; default #FFFFFF.
heightnumberyesPixels before scale, above 0 and at most 32768.
idstringnopattern ^itm_[0123456789abcdefghjkmnpqrstvwxyz]{10}$
radiusnumbernoPixels, 0 or more; rounded_rect only.
shaperect, rounded_rect, ellipseyes
startstringyesA time with a unit: "12.5s", "375f" or "00:00:12.500"
stroke_colorstringnoA colour; default #000000.
stroke_widthnumbernoPixels, 0 or more.
track_idstringnoA visual track; omitted, the highest visual track free over the item (an empty track you made for video counts; pass track_id to keep it clear), or a new one on top. effective.track_id names it.; pattern ^trk_[0123456789abcdefghjkmnpqrstvwxyz]{10}$
widthnumberyesPixels before scale, above 0 and at most 32768.
xnumberno
ynumberno

Errors#

Scope#

Scope edit. The scope is the one an API key needs in network mode. Run stuarty command:help shape.add for the same description from the binary, or call the command_help tool.

Next steps#

As an MCP call

tools/call
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "edit",
    "arguments": {
      "project_id": "prj_7k2m9x4q1b",
      "base_revision": 12,
      "operations": [
        {
          "op": "shape.add",
          "args": {
            "duration": "3s",
            "fill": "#ff0000",
            "height": 200,
            "shape": "rect",
            "start": "0s",
            "track_id": "trk_f6g7h8j9k0",
            "width": 400
          }
        }
      ]
    }
  }
}

As a batch file for the CLI

batch.json
[
  {
    "op": "shape.add",
    "args": {
      "duration": "3s",
      "fill": "#ff0000",
      "height": 200,
      "shape": "rect",
      "start": "0s",
      "track_id": "trk_f6g7h8j9k0",
      "width": 400
    }
  }
]
Terminal
stuarty edit --project prj_7k2m9x4q1b --ops batch.json --json

Over HTTP

curl
curl -X POST "http://127.0.0.1:7878/api/v1/projects/prj_7k2m9x4q1b/edit" \
  -H "Authorization: Bearer $STUARTY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "base_revision": 12,
  "operations": [
    {
      "op": "shape.add",
      "args": {
        "duration": "3s",
        "fill": "#ff0000",
        "height": 200,
        "shape": "rect",
        "start": "0s",
        "track_id": "trk_f6g7h8j9k0",
        "width": 400
      }
    }
  ]
}'

The ids in the example are illustrative: read the real ones with project_get.