MCP: Script (#191) #204

Merged
crowmaki merged 2 commits from issue-191-mcp-script into main 2026-10-12 04:31:51 +00:00
Owner

Closes #191 (part of #157).

What changed

  • import_script imports an OSF file from an absolute path and returns the import summary. A relative path is refused.
  • read_script returns the Scenes with their Lines: ids, kinds, text, Characters, cue extensions, and the SUBTITLE language and text.
    • It filters to one Scene with sceneId. With productionOnly, it leaves out omitted Scenes. An unknown Scene is refused.
    • Each Line also shows durationMs and timing (estimate, manual, take or performance), as the Scene's Animatic plays it. This makes the duration and reading-rate setters visible in the read.
    • Setups and cast are left to the coverage tools.
  • Setters: set_scene_lighting and set_scene_ambience return the Scene. set_subtitle and set_line_duration return the Line. set_reading_rates returns the Project. Each one calls the existing ApiImpl command, so it records undo and emits change events.
  • get_project now also returns the Lighting list and the reading rates, so a harness can find Lighting ids.
  • The server instructions' glossary now covers SUBTITLE Lines, omitted Scenes, Lighting and Ambience.

Tests

  • cargo test --workspace passes.
  • New src-tauri/tests/mcp_script.rs covers:
    • importing, then reading back the Scenes and Lines
    • the Scene filter and the production-only filter
    • each setter changing the read and emitting a change event
    • every script tool with no Project open
    • a relative import path
    • setting a non-SUBTITLE Line's subtitle

Notes

  • set_subtitle sets the language and the text together, as the UI command does, so a field left out is cleared. The tool description says so.
  • read_script builds the Animatic for each Scene it returns, so a full-script read costs one Animatic per Scene.
  • I did not check this in the running app.
Closes #191 (part of #157). ## What changed - **`import_script`** imports an OSF file from an absolute path and returns the import summary. A relative path is refused. - **`read_script`** returns the Scenes with their Lines: ids, kinds, text, Characters, cue extensions, and the SUBTITLE language and text. - It filters to one Scene with `sceneId`. With `productionOnly`, it leaves out omitted Scenes. An unknown Scene is refused. - Each Line also shows `durationMs` and `timing` (`estimate`, `manual`, `take` or `performance`), as the Scene's Animatic plays it. This makes the duration and reading-rate setters visible in the read. - Setups and cast are left to the coverage tools. - **Setters:** `set_scene_lighting` and `set_scene_ambience` return the Scene. `set_subtitle` and `set_line_duration` return the Line. `set_reading_rates` returns the Project. Each one calls the existing `ApiImpl` command, so it records undo and emits change events. - **`get_project`** now also returns the Lighting list and the reading rates, so a harness can find Lighting ids. - The server instructions' glossary now covers SUBTITLE Lines, omitted Scenes, Lighting and Ambience. ## Tests - `cargo test --workspace` passes. - New `src-tauri/tests/mcp_script.rs` covers: - importing, then reading back the Scenes and Lines - the Scene filter and the production-only filter - each setter changing the read and emitting a change event - every script tool with no Project open - a relative import path - setting a non-SUBTITLE Line's subtitle ## Notes - `set_subtitle` sets the language and the text together, as the UI command does, so a field left out is cleared. The tool description says so. - `read_script` builds the Animatic for each Scene it returns, so a full-script read costs one Animatic per Scene. - I did not check this in the running app.
- `import_script` imports an OSF file from an absolute path and returns
  the import summary.
- `read_script` returns the Scenes with their Lines (ids, kinds, text,
  Characters, SUBTITLE fields) and each Line's Animatic duration and
  timing source, filtered to one Scene and optionally to production
  Scenes. Setups and cast are left to the coverage tools.
- `set_scene_lighting` and `set_scene_ambience` return the Scene;
  `set_subtitle` and `set_line_duration` return the Line;
  `set_reading_rates` returns the Project.
- `get_project` now also shows the Lighting list and the reading rates,
  so a harness can find Lighting ids.
- Skip the Animatic for an omitted Scene, which has none, instead of relying on its having no Lines.
- Build one Line without panicking when the views disagree.
- Rename after/absolute to then_read/require_absolute; production_only throughout.
- Add SUBTITLE, omitted Scenes, Lighting and Ambience to the server instructions' glossary.
- Test every script tool with no Project open, and clearing a Scene's Lighting.
crowmaki deleted branch issue-191-mcp-script 2026-10-12 04:31:51 +00:00
Sign in to join this conversation.
No description provided.