# recording.apply_layout

> Frames a screen and a webcam clip in a layout.

Source: https://stuarty.com/docs/mcp/tools/edit/recording.apply_layout/

Places a screen clip and, for every layout but screen_only, a webcam clip by a named layout made for the project format (16:9, 1:1, 4:5 or 9:16): screen_only, pip (the camera over a corner of the screen, a circle by default), split (side by side in 16:9, one above the other in the others) or camera_focus (the camera fills the frame, the screen is a small inset). padding is a fraction of the shorter side of the frame, 0 to 0.25, left empty around everything. The result is ordinary fit, position, scale, crop and mask values, so every one stays editable, and no clip leaves the frame. The clip in front is put on the upper track. A clip whose x, y, scale, rotation or crop has keyframes cannot be laid out: apply the layout before recording.auto_zoom.

## Arguments

| Argument | Type | Required | Notes |
| --- | --- | --- | --- |
| `camera_item_id` | `string` | no | The clip of the webcam take; required by every layout but screen_only, which refuses it.; pattern `^itm_[0123456789abcdefghjkmnpqrstvwxyz]{10}$` |
| `camera_shape` | `circle`, `rect` | no | For pip. circle (default) or rect. |
| `corner` | `top_left`, `top_right`, `bottom_left`, `bottom_right` | no | For pip and camera_focus. Default bottom_right. |
| `layout` | `screen_only`, `pip`, `split`, `camera_focus` | yes | Screen_only, pip, split or camera_focus. |
| `padding` | `number` | no | Fraction of the shorter side of the frame left empty around everything, 0 to 0.25. Default 0.; min 0; max 0.25 |
| `screen_item_id` | `string` | yes | The clip of the screen take.; pattern `^itm_[0123456789abcdefghjkmnpqrstvwxyz]{10}$` |

## Errors

- [`E_VALIDATION`](/docs/reference/error-codes#e_validation)
- [`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)

## Scope

Scope `edit`. The scope is the one an API key needs in network mode. Run `stuarty command:help recording.apply_layout` 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": "recording.apply_layout",
          "args": {
            "camera_item_id": "itm_s6t7v8w9x0",
            "corner": "bottom_left",
            "layout": "pip",
            "screen_item_id": "itm_m1n2p3q4r5"
          }
        }
      ]
    }
  }
}
```

**As a batch file for the CLI**

```json
[
  {
    "op": "recording.apply_layout",
    "args": {
      "camera_item_id": "itm_s6t7v8w9x0",
      "corner": "bottom_left",
      "layout": "pip",
      "screen_item_id": "itm_m1n2p3q4r5"
    }
  }
]
```

```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": "recording.apply_layout",
      "args": {
        "camera_item_id": "itm_s6t7v8w9x0",
        "corner": "bottom_left",
        "layout": "pip",
        "screen_item_id": "itm_m1n2p3q4r5"
      }
    }
  ]
}'
```

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