MCP: Queue Takes and review them (#197) #211

Merged
crowmaki merged 2 commits from issue-197-mcp-takes into main 2026-10-14 04:41:52 +00:00
Owner

Closes #197. Part of #157.

A harness can now render coverage and review it through the MCP server. Each tool wraps the existing ApiImpl Take command, so edits land in the undo log with their usual labels.

Tools

  • queue_take: queues a draft or a Single-pass final (singlePassFinal), with an optional seed and profile. If a Shot can't be queued (a broken slot tag, a Shot over covered and uncovered Lines…), the app's reason comes back as a tool error.
  • read_shot_takes: a Shot's Takes. read_scene_takes: each Shot of a Scene with its Takes and playedTakeId. A Take shows its status, kind, seed, the circled, pinned, NG, seen and stale flags, Stale reasons, notes and Line marks. Each Rendition shows its absolute masterPath and proxyPath.
  • view_image accepts {kind: "take", id, renditionId?, frames?}. It samples frames evenly across the video with the app's ffmpeg (4 by default, 12 at most) and scales them down to maxSize. saveTo is refused for a Take; the error points to the Rendition paths instead.
  • circle_take, pin_take, set_take_ng, add_take_note (with optional atMs), remove_take_note.
  • retry_take, delete_take, delete_failed_takes (a whole Scene), retry_post_steps.
  • set_take_mark and reset_take_marks.
  • No tool marks a Take seen, and viewing frames doesn't either. The server instructions say so.

Core changes

  • wait_for_jobs now reports a Take's job as running until its Rendition's post-steps finish (job_statuses). Before this, a finished wait could find the Take still finishing, with no files yet.
  • TakeView::kind and TakeView::stale decide a Take's kind and staleness in the core (ADR-0003), and they appear on TakeDto. The edit package uses stale() too.
  • New: rendition_paths, take_shot, take_video, and Ffmpeg::sample_frames. Sampling runs outside the session lock.

Tests

src-tauri/tests/mcp_takes.rs covers each acceptance criterion:

  • refusals: no Project, unknown Shot, broken slot tag
  • queue → wait_for_jobs → listed with an existing masterPath → view_image returns frames, and the frame count is capped
  • a Single-pass final queued with a profile; its failed post-steps are retried
  • circle, pin, NG and notes with their undo labels
  • Line marks moved and reset
  • failed Takes retried and deleted
  • no tool named for "seen", and Takes stay unseen throughout

There are also ffmpeg unit tests for frame sampling. mp4, ready_rendition, undo_label and shown_images moved into tests/common/mcp.rs.

Not tested: the refusal for a Shot over covered and uncovered Lines. The core refuses it, and it comes back the same way as the broken slot tag.

Closes #197. Part of #157. A harness can now render coverage and review it through the MCP server. Each tool wraps the existing `ApiImpl` Take command, so edits land in the undo log with their usual labels. ## Tools - `queue_take`: queues a draft or a Single-pass final (`singlePassFinal`), with an optional `seed` and `profile`. If a Shot can't be queued (a broken slot tag, a Shot over covered and uncovered Lines…), the app's reason comes back as a tool error. - `read_shot_takes`: a Shot's Takes. `read_scene_takes`: each Shot of a Scene with its Takes and `playedTakeId`. A Take shows its status, kind, seed, the circled, pinned, NG, seen and stale flags, Stale reasons, notes and Line marks. Each Rendition shows its absolute `masterPath` and `proxyPath`. - `view_image` accepts `{kind: "take", id, renditionId?, frames?}`. It samples frames evenly across the video with the app's ffmpeg (4 by default, 12 at most) and scales them down to `maxSize`. `saveTo` is refused for a Take; the error points to the Rendition paths instead. - `circle_take`, `pin_take`, `set_take_ng`, `add_take_note` (with optional `atMs`), `remove_take_note`. - `retry_take`, `delete_take`, `delete_failed_takes` (a whole Scene), `retry_post_steps`. - `set_take_mark` and `reset_take_marks`. - No tool marks a Take seen, and viewing frames doesn't either. The server instructions say so. ## Core changes - `wait_for_jobs` now reports a Take's job as `running` until its Rendition's post-steps finish (`job_statuses`). Before this, a finished wait could find the Take still `finishing`, with no files yet. - `TakeView::kind` and `TakeView::stale` decide a Take's kind and staleness in the core (ADR-0003), and they appear on `TakeDto`. The edit package uses `stale()` too. - New: `rendition_paths`, `take_shot`, `take_video`, and `Ffmpeg::sample_frames`. Sampling runs outside the session lock. ## Tests `src-tauri/tests/mcp_takes.rs` covers each acceptance criterion: - refusals: no Project, unknown Shot, broken slot tag - queue → `wait_for_jobs` → listed with an existing `masterPath` → `view_image` returns frames, and the frame count is capped - a Single-pass final queued with a profile; its failed post-steps are retried - circle, pin, NG and notes with their undo labels - Line marks moved and reset - failed Takes retried and deleted - no tool named for "seen", and Takes stay unseen throughout There are also ffmpeg unit tests for frame sampling. `mp4`, `ready_rendition`, `undo_label` and `shown_images` moved into `tests/common/mcp.rs`. Not tested: the refusal for a Shot over covered and uncovered Lines. The core refuses it, and it comes back the same way as the broken slot tag.
queue_take queues a draft or Single-pass final, refusals coming back as
tool errors. read_shot_takes and read_scene_takes list Takes with their
kind, flags and each Rendition's master and proxy paths. view_image takes
a Take as frames sampled across its video with the app's ffmpeg. Circle,
pin, NG, notes, Line marks, retrying and deleting failed Takes and
retrying post-steps round-trip; no tool marks a Take seen.

A Take's job now stays running in wait_for_jobs until its Rendition's
post-steps finish, so a finished wait finds the Take's files in place.
Decide a Take's kind and whether it is stale in the core (TakeView::kind
and ::stale, on TakeDto), so the MCP layer only adds file paths. take_video
reuses rendition_file instead of repeating its filter. Share undo_label
and shown_images through common::mcp. Test a Single-pass final queued with
a profile, whose failed post-steps are retried.
crowmaki deleted branch issue-197-mcp-takes 2026-10-14 04:41:52 +00:00
Sign in to join this conversation.
No description provided.