# caption.add

> Adds a caption item with timed words.

Source: https://stuarty.com/docs/mcp/tools/edit/caption.add/

Adds a caption. Give either words (times relative to the caption, as lengths) or text with a duration: the text is split on whitespace and the words share the duration in proportion to their character counts. x and y are used when the caption style position of the track is custom.

## Arguments

| Argument | Type | Required | Notes |
| --- | --- | --- | --- |
| `duration` | `string` | no | A length; with text only. |
| `id` | `string` | no | pattern `^itm_[0123456789abcdefghjkmnpqrstvwxyz]{10}$` |
| `linked_item` | `string` | no | The clip whose speech this transcribes; it need not exist. |
| `start` | `string` | yes | A time with a unit: "12.5s", "375f" or "00:00:12.500" |
| `text` | `string` | no | Text to split on whitespace; needs duration. |
| `track_id` | `string` | no | A 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}$` |
| `words` | array of `object` | no | Words with times relative to the caption, as lengths. |
| `x` | `number` | no |  |
| `y` | `number` | no |  |

## Errors

- [`E_VALIDATION`](/docs/reference/error-codes#e_validation)
- [`E_INVALID_TIME`](/docs/reference/error-codes#e_invalid_time)
- [`E_NOT_FOUND`](/docs/reference/error-codes#e_not_found)
- [`E_TYPE_MISMATCH`](/docs/reference/error-codes#e_type_mismatch)
- [`E_INVALID_STATE`](/docs/reference/error-codes#e_invalid_state)
- [`E_ID_EXISTS`](/docs/reference/error-codes#e_id_exists)
- [`E_LIMIT`](/docs/reference/error-codes#e_limit)
- [`E_OVERLAP`](/docs/reference/error-codes#e_overlap)

## Scope

Scope `edit`. The scope is the one an API key needs in network mode. Run `stuarty command:help caption.add` for the same description from the binary, or call the [`command_help`](/docs/mcp/tools/command_help) tool.

## Next steps

- [The edit tool](/docs/mcp/tools/edit)
- [Batches, revisions and idempotency](/docs/agents/batches)

**As an MCP call**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "edit",
    "arguments": {
      "project_id": "prj_7k2m9x4q1b",
      "base_revision": 12,
      "operations": [
        {
          "op": "caption.add",
          "args": {
            "duration": "48f",
            "id": "itm_s6t7v8w9x0",
            "linked_item": "itm_m1n2p3q4r5",
            "start": "12f",
            "text": "Meet the new editor.",
            "track_id": "trk_a1b2c3d4e5"
          }
        }
      ]
    }
  }
}
```

**As a batch file for the CLI**

```json
[
  {
    "op": "caption.add",
    "args": {
      "duration": "48f",
      "id": "itm_s6t7v8w9x0",
      "linked_item": "itm_m1n2p3q4r5",
      "start": "12f",
      "text": "Meet the new editor.",
      "track_id": "trk_a1b2c3d4e5"
    }
  }
]
```

```bash
stuarty edit --project prj_7k2m9x4q1b --ops batch.json --json
```

**Over HTTP**

```bash
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": "caption.add",
      "args": {
        "duration": "48f",
        "id": "itm_s6t7v8w9x0",
        "linked_item": "itm_m1n2p3q4r5",
        "start": "12f",
        "text": "Meet the new editor.",
        "track_id": "trk_a1b2c3d4e5"
      }
    }
  ]
}'
```

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