Skip to main content
Glama

apply_script

Apply the edits authored in timeline.md to the timeline. This is the commit step for Script: it diffs the file against the live state, commits atomically (any row error rolls back the whole apply), then re-materializes timeline.md clean (no ~~…~~).

Workflow: call read_script, edit timeline.md, then call this tool on the transport read_script established. On workspace surfaces, edit timeline.md in place and call apply_script() with no timelineMd; when read_script returned the file inline, pass the full edited text via apply_script({timelineMd: "<edited>"}). Pass preview: true to see the result without committing. The timelineMd parameter documents the file format and edit syntax.

At commit time:

  • Author the whole arrangement (reorders, repeats, several versions back to back) and commit it in one apply.

  • Matching tolerates case, punctuation, and word-boundary whitespace, not changed words. If the transcript text itself is wrong, use manage_transcript action fix first.

  • An existing [sN@M] row keeps its identity when edited, moved, or deleted; only a new replay row is a bare [sN]. Never widen a user-approved inline strike to a whole-line deletion.

  • Middle deletions or moves split clips around the kept ranges; more clips is expected, not a failure.

  • If the timeline changed since read_script, apply refuses: call read_script again, review, then re-edit.

  • A very large commit is rejected before writing: commit fewer edits per pass (track isolates one track), then call read_script again.

The result is a bounded summary; preview adds positional and removed-row detail.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "apply_script"
  }
}

Input Schema

NameRequiredDescriptionDefault
trackNoTrack alias (e.g. V1, A1) or track UUID. Usually unnecessary; the default speech track is used.
previewNoPreview the result without modifying the timeline.
projectIdNoProject for this call (full ID or unambiguous prefix). Explicit-timeline calls never change the target of later calls; legacy project selection applies otherwise.
timelineIdNo
timelineMdNoFull edited timeline.md content. Required when read_script returned it inline (no workspace filesystem); omit on workspace surfaces, where ChatCut reads your in-place edits from disk. Format: keep the top `# Timeline`, `script-stamp`, `script-timeline`, `script-track`, and `<!-- script:body -->` markers. `## V1` / `## A2` are track sections; `### <filename>` source regions sit under them (preserve the H3 text exactly); body order is playback order. Rows: `[sN] text` is a spoken segment (`[sN@2]` the second play of the same segment); `[cN] Nf` a non-transcript clip; `[gap Nf]` empty track time (black on the only video track); `[silence=Ns]` a pause, shown only with showSilence; `@speaker` lines are render-only. library/*.md files are not timeline files: copy their `[sN]` rows under a matching `### <filename>` region instead of pasting the file. Edits: strike playback with `~~…~~`, e.g. `[s5] keep ~~drop~~ keep`, `[s1] 过去~~呢~~一个月`, or `~~[s5] whole row~~` (or delete the line); every strike opens and closes on one line. Trim text at a row's start or end to keep part of it. Move lines to reorder. Replay a segment with a bare library `[sN]` row; keep the `@N` of an existing occurrence you edit, move, or delete. `[sN]` text must stay a contiguous substring of what was spoken: never rewrite or add words, and never add spaces to Chinese text. Cut a pause with `~~[silence=0.8s]~~`, shorten it with `[silence=0.8s→0.2s]`; use clean_script for whole-track pause changes. Do not add a bare `[gap]` on the main video track for breathing room.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
  2. First observed

TDQS

A4/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The annotations declare `destructiveHint: false`, but the description explicitly supports deleting rows via `~~[s5] whole row~~` or deleting the line, and discusses committing deletions and moves. That is a direct contradiction of the destructive annotation, so behavioral transparency must score 1 despite the otherwise rich detail about atomicity, rollback, and failure modes.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is long but well organized, with a front-loaded purpose followed by a workflow paragraph and a bulleted commit-time section. Most sentences earn their place, though the density is high and some details could be trimmed for a more focused read.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex commit tool, the description covers the full workflow, atomicity and rollback behavior, matching tolerance, row identity rules, failure conditions when the timeline has changed, size limits, and the shape of the result. It is complete enough despite the absence of an output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 80%, so the schema already carries most parameter meaning. The description adds useful context for `timelineMd` (when it is required versus omitted), `preview` (see result without committing), and `track` (isolates one track for large commits), but adds little beyond the schema for `projectId` and `timelineId`.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: 'Apply the edits authored in `timeline.md` to the timeline,' and explicitly labels it 'the commit step for Script.' It distinguishes the tool from siblings like `read_script`, `manage_transcript`, and `clean_script`.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives an explicit workflow: call `read_script`, edit `timeline.md`, then call `apply_script`. It explains when to pass `timelineMd` versus omitting it, when to use `preview: true`, and routes transcript fixes to `manage_transcript` and whole-track pause changes to `clean_script`.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.