Skip to content

MCP: edit operations

composition.create_from_selection

Moves the selected items into a new timeline, as one composition clip.

Last updated:

Makes a new timeline of the project from the selected items (same tracks, same frame size and rate, starting at frame 0) and replaces them with one composition of it, on the top-most visual track of the selection, for the same frames. The inverse puts the items back; the new timeline stays in the project.

Arguments#

ArgumentTypeRequiredNotes
idstringnoThe id of the composition item.; pattern ^itm_[0123456789abcdefghjkmnpqrstvwxyz]{10}$
item_idsarray of stringyesThe items to move, each once.; at least 1 items; at most 100 items
namestringnoThe name of the new timeline; default Composition.; min length 1; max length 120
timeline_idstringnoThe id of the new timeline.; pattern ^prj_[0123456789abcdefghjkmnpqrstvwxyz]{10}$

Errors#

Scope#

Scope edit. The scope is the one an API key needs in network mode. Run stuarty command:help composition.create_from_selection 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": "composition.create_from_selection",
          "args": {
            "id": "itm_k1k2k3k4k5",
            "item_ids": [
              "itm_m1n2p3q4r5",
              "itm_c3d4e5f6g7"
            ],
            "name": "Intro",
            "timeline_id": "prj_a1b2c3d4e5"
          }
        }
      ]
    }
  }
}

As a batch file for the CLI

batch.json
[
  {
    "op": "composition.create_from_selection",
    "args": {
      "id": "itm_k1k2k3k4k5",
      "item_ids": [
        "itm_m1n2p3q4r5",
        "itm_c3d4e5f6g7"
      ],
      "name": "Intro",
      "timeline_id": "prj_a1b2c3d4e5"
    }
  }
]
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": "composition.create_from_selection",
      "args": {
        "id": "itm_k1k2k3k4k5",
        "item_ids": [
          "itm_m1n2p3q4r5",
          "itm_c3d4e5f6g7"
        ],
        "name": "Intro",
        "timeline_id": "prj_a1b2c3d4e5"
      }
    }
  ]
}'

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