goatedit-mcp 1.1.7 → 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19294,14 +19294,16 @@ var BASE_TOOLS = [
19294
19294
  },
19295
19295
  {
19296
19296
  name: "export_range",
19297
- description: "Sample a stretch of timeline: a few rendered frames spread across it, plus the measured audio for the same range. Use it to check a sequence of cuts, a transition, or a whole section in one call, where render_preview_frame answers for a single moment.",
19297
+ description: 'Sample a stretch of timeline: rendered frames spread across it, plus the measured audio for the same range. Use it to check a sequence of cuts, a transition, or a whole section in one call, where render_preview_frame answers for a single moment. Up to 6 frames come back as separate pictures; 7 to 24 come back as one tiled sheet stamped with times, which is how a motion is best judged. With video: true it encodes the range as an MP4 (up to 60 seconds) in the background: the first call starts it and answers status "running", and the same call again returns the file once it is done \u2014 the local server saves it to disk and replies with its path.',
19298
19298
  inputSchema: {
19299
19299
  type: "object",
19300
19300
  properties: {
19301
19301
  startTime: num("Start of the range in seconds."),
19302
19302
  endTime: num("End of the range in seconds. Ranges over 10 minutes are refused."),
19303
- frames: num("How many frames to sample, up to 6. Defaults to 4."),
19304
- width: num("Width of each frame in pixels. Defaults to 640."),
19303
+ frames: num("How many frames to sample, up to 24; over 6 they come back as one tiled sheet. Defaults to 4."),
19304
+ width: num("Width of each frame in pixels (default 640), of the sheet (default 1280), or of the video (default 640)."),
19305
+ video: bool('Encode the range as an MP4 instead of sampling frames. Call again with the same arguments until status is "done".'),
19306
+ fps: num("Video frame rate. Defaults to the project's."),
19305
19307
  skipAdjustments: SKIP_ADJUSTMENTS,
19306
19308
  hideClipIds: HIDE_CLIP_IDS
19307
19309
  },
@@ -19329,7 +19331,7 @@ var BASE_TOOLS = [
19329
19331
  },
19330
19332
  {
19331
19333
  name: "clean_unused_sequences",
19332
- description: "Find nested sequences that no clip uses any more \u2014 left behind when a nest clip is removed or a shot is rebuilt \u2014 and optionally delete them with their bin items. Without apply it only lists them. Top-level sequences, and nests reachable from one or open in a tab, are never touched.",
19334
+ description: "Find nested sequences that no clip uses any more \u2014 left behind when a nest clip is removed or a shot is rebuilt \u2014 and optionally delete them with their bin items. Without apply it only lists them. A scene (a sequence once placed with add_sequence_clip) counts as a nest. Other top-level sequences, and nests reachable from one or open in a tab, are never touched; top-level ones nothing plays are listed under otherUnplayed for delete_sequence.",
19333
19335
  inputSchema: {
19334
19336
  type: "object",
19335
19337
  properties: {
@@ -19338,6 +19340,18 @@ var BASE_TOOLS = [
19338
19340
  },
19339
19341
  method: "cleanUnusedSequences"
19340
19342
  },
19343
+ {
19344
+ name: "delete_sequence",
19345
+ description: "Delete one or more sequences by id, with their bin items. Clips in other sequences that played them are removed too and listed in the reply. The open sequence is refused: open another first. Undo restores everything.",
19346
+ inputSchema: {
19347
+ type: "object",
19348
+ properties: {
19349
+ sequenceId: str("Sequence to delete, from list_sequences."),
19350
+ sequenceIds: { type: "array", items: { type: "string" }, description: "Several at once, in one undo step. Use instead of sequenceId." }
19351
+ }
19352
+ },
19353
+ method: "deleteSequence"
19354
+ },
19341
19355
  {
19342
19356
  name: "list_sequences",
19343
19357
  description: "Every sequence in the project: id, name, whether it is the one open for editing, open in a tab, a nest (made by nest_clips) or top-level, its length, how many clips it holds, and the clips that play it. Every other tool edits the open sequence only \u2014 use this to find the id to pass to open_sequence.",
@@ -19596,14 +19610,17 @@ var BASE_TOOLS = [
19596
19610
  },
19597
19611
  {
19598
19612
  name: "create_shape_clip",
19599
- description: "Draw a solid shape on the timeline \u2014 a rectangle, square or circle, with an optional stroke and rounded corners. This is how you get a colour behind something: a full-frame backdrop for a title, a lower-third plate, a letterbox bar. Pass fullFrame to size a rectangle to the whole frame without working out the units. Nothing needs importing; the compositor draws it.",
19613
+ description: "Draw a solid shape on the timeline \u2014 a rectangle, square or circle, with an optional stroke and rounded corners, or any outline as a path (a line, an arrow, a star, an underline). This is how you get a colour behind something: a full-frame backdrop for a title, a lower-third plate, a letterbox bar. Pass fullFrame to size a rectangle to the whole frame without working out the units. A path takes `path` (SVG path data in the frame's own pixels) or `points`; it starts as a white 4-unit stroke with no fill unless color or strokeColor is given, and update_shape_clip trimEnd keyframed 0 to 1 draws it on. Nothing needs importing; the compositor draws it.",
19600
19614
  inputSchema: {
19601
19615
  type: "object",
19602
19616
  properties: {
19603
19617
  duration: num("How long the shape stays on screen, in seconds."),
19604
19618
  startTime: num("Where it starts on the timeline, in seconds. Defaults to 0."),
19605
19619
  trackId: str('Target video track, or "__new_video__" to pick one free across the span. Defaults to the latter.'),
19606
- shapeType: { type: "string", enum: ["rectangle", "square", "circle"], description: "Shape to draw. Defaults to rectangle." },
19620
+ shapeType: { type: "string", enum: ["rectangle", "square", "circle", "path"], description: "Shape to draw. Defaults to rectangle, or path when path or points is given." },
19621
+ path: str('Path shape: SVG path data in frame pixels, e.g. "M 300 800 C 700 600 1200 1000 1620 760" for a curve across a 1920\xD71080 frame. M, L, H, V, C, S, Q and Z, absolute or relative; arcs are not supported. Each extra M starts another outline on the same layer with the same paint (not a hole). width, height and cornerRadius do not apply.'),
19622
+ points: { type: "array", items: { type: "object" }, description: 'Path shape as anchors instead of `path`: [{ "x": 0..1, "y": 0..1 }], fractions of the frame, with optional bezier handles hiX/hiY (incoming) and hoX/hoY (outgoing) as offsets from the anchor in the same units.' },
19623
+ closed: bool("Path shape: join the last anchor back to the first. Defaults to what `path` says (Z), or false for points."),
19607
19624
  color: str('Fill colour, e.g. "#000000". Defaults to black.'),
19608
19625
  fullFrame: bool("Size a rectangle to cover the whole frame. Overrides width and height."),
19609
19626
  width: num("Width in design units against a 1080p-tall frame. Defaults to 300."),
@@ -19638,7 +19655,13 @@ var BASE_TOOLS = [
19638
19655
  strokeCap: { type: "string", enum: ["butt", "round", "square"], description: "Ends of an open or dashed outline." },
19639
19656
  strokeJoin: { type: "string", enum: ["miter", "round", "bevel"], description: "Outline corners." },
19640
19657
  dash: num("Dash length for a dashed outline, design units. 0 for solid."),
19641
- gap: num("Gap between dashes, design units.")
19658
+ gap: num("Gap between dashes, design units."),
19659
+ path: str("Path shapes: replace the outline, SVG path data in frame pixels (see create_shape_clip). The layer is re-centred on the new outline."),
19660
+ points: { type: "array", items: { type: "object" }, description: "Path shapes: replace the outline with anchors, fractions of the frame." },
19661
+ closed: bool("Path shapes: join the last anchor back to the first."),
19662
+ trimStart: num("Path shapes: where along the path drawing starts, 0..1. Keyframe it as pathTrimStart."),
19663
+ trimEnd: num("Path shapes: where drawing stops, 0..1. 0 hides the path; keyframing pathTrimEnd 0 to 1 with set_keyframes draws it on."),
19664
+ trimOffset: num("Path shapes: slides the drawn stretch along the path, degrees.")
19642
19665
  },
19643
19666
  required: ["clipId"]
19644
19667
  },
@@ -19924,6 +19947,35 @@ var BASE_TOOLS = [
19924
19947
  },
19925
19948
  method: "removeBackground"
19926
19949
  },
19950
+ {
19951
+ name: "measure_text",
19952
+ description: 'How big a piece of text comes out, in frame pixels and as fractions of the frame, without rendering: width, height, the box it covers at its position, how it wrapped (`lines`), and `fitScale` below 1 when it was shrunk to fit the frame. Pass text and any create_text_clip style fields to size a caption before placing it \u2014 to fit a plate behind it, or pick a fontSize that fills a width. Pass clipId to measure a clip as it is, and style fields with it to ask "what if".',
19953
+ inputSchema: {
19954
+ type: "object",
19955
+ properties: {
19956
+ text: str("The words to measure. With clipId, replaces the clip's text for this measurement only."),
19957
+ clipId: str("A text clip to measure. Nothing on it is changed."),
19958
+ time: num("With clipId: timeline time in seconds to measure at, for keyframed size or scale. Defaults to the clip's start."),
19959
+ ...TEXT_STYLE_PROPS,
19960
+ posX: num("Horizontal centre as a fraction of the frame, for the box. Defaults to 0.5."),
19961
+ posY: num("Vertical centre as a fraction of the frame, for the box. Defaults to 0.5.")
19962
+ }
19963
+ },
19964
+ method: "getTextSize"
19965
+ },
19966
+ {
19967
+ name: "set_markers",
19968
+ description: 'Point markers on the timeline ruler \u2014 beats, cue points, a note to the user about a moment. With no arguments it lists every marker (scenes from set_scene included, with their duration). `add` places several at once, `remove` deletes by id, and `removeLabelPrefix` clears every point marker whose label starts with it (e.g. "Beat " to re-mark beats). Removals run before additions, all in one undo step. Scene markers are left to set_scene.',
19969
+ inputSchema: {
19970
+ type: "object",
19971
+ properties: {
19972
+ add: { type: "array", items: { type: "object" }, description: 'Markers to place: [{ "time": seconds, "label"?: "Drop", "color"?: "#eab308" }]. Colour cycles a palette when omitted.' },
19973
+ remove: { type: "array", items: { type: "string" }, description: "Marker ids to delete." },
19974
+ removeLabelPrefix: str("Delete every point marker whose label starts with this.")
19975
+ }
19976
+ },
19977
+ method: "setMarkers"
19978
+ },
19927
19979
  {
19928
19980
  name: "set_scene",
19929
19981
  description: "Mark a stretch of timeline as a named scene (a ruler marker with a length), so retime_range can move or stretch it as one piece later. With start and end it makes a scene; with sceneId it changes one (start, end, label, color) or deletes it (remove: true); with no arguments it lists every scene.",
@@ -20290,7 +20342,7 @@ var BASE_TOOLS = [
20290
20342
  clipId: CLIP_ID,
20291
20343
  type: {
20292
20344
  type: "string",
20293
- description: "Effect type: blur, invert, hue, saturation, brightness, contrast, exposure, grayscale, sepia, gradientMap, vignette, filmGrain, flicker, posterizeTime, lensDistortion, chromaticAberration, lensFlare, liquidGlass, opacityFx, colorCorrection, depthMap, gradientMap, glow, pixelDissolve, motionBlur, dropShadow, reflection, colorama, outline, echo, flutedGlass, lightRays, halftone, datamosh, roughenEdges, filmStock, halation, starGlow, thermal, colorBalance, duotone, levels, monochrome, channelMixer, dither, threshold, lensBlur, directionalBlur, spinBlur, zoomBlur, sharpen, cameraShake, bulge, twirl, ripple, waveWarp, polarCoords, turbulentDisplace, elasticGrid, gridSplit, cubify, glitch, vhs, ntsc, crtScreen, ledScreen, rgbSplit, jpegGlitch, ascii, macpaint, modulation, stripe, risograph, emboss, bevel, inkBleed, paperTexture, paperCutout, crossHatch, scatter, blobTracker, edgeGlow, pageTurn, lightSweep, deepGlow, twister, fill, grid, repeater, plus transform, layer3d, model3d and showcase. Call describe_effect with a type for its parameters, their ranges and what they do before setting anything but the obvious. An unknown name comes back with the full list."
20345
+ description: "Effect type: blur, invert, hue, saturation, brightness, contrast, exposure, grayscale, sepia, gradientMap, vignette, filmGrain, flicker, posterizeTime, lensDistortion, chromaticAberration, lensFlare, liquidGlass, opacityFx, colorCorrection, depthMap, gradientMap, glow, pixelDissolve, motionBlur, dropShadow, reflection, colorama, outline, echo, flutedGlass, lightRays, halftone, datamosh, roughenEdges, filmStock, halation, starGlow, filmDamage, lightLeak, thermal, colorBalance, duotone, levels, monochrome, channelMixer, dither, threshold, lensBlur, directionalBlur, spinBlur, zoomBlur, sharpen, cameraShake, bulge, twirl, ripple, waveWarp, polarCoords, turbulentDisplace, elasticGrid, gridSplit, cubify, glitch, vhs, ntsc, crtScreen, ledScreen, rgbSplit, jpegGlitch, ascii, macpaint, modulation, stripe, risograph, emboss, bevel, inkBleed, paperTexture, paperCutout, crossHatch, scatter, blobTracker, edgeGlow, pageTurn, lightSweep, deepGlow, twister, fill, grid, repeater, plus transform, layer3d, model3d and showcase. Call describe_effect with a type for its parameters, their ranges and what they do before setting anything but the obvious. An unknown name comes back with the full list."
20294
20346
  },
20295
20347
  params: {
20296
20348
  type: "object",
@@ -20532,6 +20584,23 @@ var BASE_TOOLS = [
20532
20584
  },
20533
20585
  method: "setProjectSettings"
20534
20586
  },
20587
+ {
20588
+ name: "set_audio_master",
20589
+ description: "The sequence\u2019s master bus: tag tracks as voice, music or sfx, duck music under voice, and put a safety limiter on the mix. Ducking follows the spans of clips on voice-role tracks (and nested sequences placed on them), dipping music-role tracks by duckDb, starting `attack` seconds before each line so the first word is clear. Playback, probe_audio and export all hear the same bus. With no arguments it reports the current roles and settings.",
20590
+ inputSchema: {
20591
+ type: "object",
20592
+ properties: {
20593
+ roles: { type: "object", description: 'Track roles: { "<trackId>": "voice" | "music" | "sfx" | "none" }.' },
20594
+ ducking: bool("Duck music-role tracks under voice-role tracks."),
20595
+ duckDb: num("How far music dips under voice, in dB (negative). Defaults to -12."),
20596
+ attack: num("Seconds the dip takes, finishing as the voice starts. Defaults to 0.25."),
20597
+ release: num("Seconds music takes to come back after the voice ends. Defaults to 0.6."),
20598
+ limiter: bool("Limit the mix so it does not clip."),
20599
+ ceilingDb: num("Limiter ceiling in dBFS. Defaults to -1.")
20600
+ }
20601
+ },
20602
+ method: "setAudioMaster"
20603
+ },
20535
20604
  {
20536
20605
  name: "apply_ai_edit",
20537
20606
  description: "Tighten the cut from the transcript: remove filler words, remove long pauses, or both. Works on the transcript derived from the clips currently on the timeline, so it respects the cuts already made. Run it with dryRun first to see exactly which ranges would go before anything is removed.",
@@ -20578,7 +20647,7 @@ var BASE_TOOLS = [
20578
20647
  },
20579
20648
  {
20580
20649
  name: "remove_clip",
20581
- description: "Remove a clip from the timeline, leaving a gap where it was.",
20650
+ description: "Remove a clip from the timeline, leaving a gap where it was. Safe to retry: a clip an earlier MCP edit already removed answers success with alreadyRemoved, while an id never seen is still an error.",
20582
20651
  inputSchema: { type: "object", properties: { clipId: CLIP_ID }, required: ["clipId"] },
20583
20652
  method: "removeClip"
20584
20653
  },
@@ -20670,6 +20739,20 @@ var BASE_TOOLS = [
20670
20739
  },
20671
20740
  method: "splitClip"
20672
20741
  },
20742
+ {
20743
+ name: "loop_clip",
20744
+ description: "Loop a clip: repeat it back to back until it fills a length \u2014 a background plate, an ambience bed, a short animation held under a longer shot. Each pass is an ordinary clip (keyframes and effects included), and the clip\u2019s linked audio loops with it. Give `times` (total passes, the original included) or `until` (timeline time to end at; the last pass is cut short to land on it). Refuses when other clips sit in the way on the same track, naming them.",
20745
+ inputSchema: {
20746
+ type: "object",
20747
+ properties: {
20748
+ clipId: CLIP_ID,
20749
+ times: num("Total passes, the original included. 2 doubles it."),
20750
+ until: num("Timeline time, in seconds, the loop should end at.")
20751
+ },
20752
+ required: ["clipId"]
20753
+ },
20754
+ method: "loopClip"
20755
+ },
20673
20756
  {
20674
20757
  name: "generate_captions",
20675
20758
  description: "Lay timed caption clips on the timeline. By default it reads the real per-word timings stored with the footage and maps them through each clip\u2019s in/out points, so the cards land on the words actually spoken. Passing `text` instead falls back to estimating from word count, which drifts \u2014 only do that when get_transcript shows no stored transcript. The cards go on one video track free across the whole caption run, creating a track above everything when none is, so a run never overwrites a watermark or a title. Styling arguments apply to every card, so a whole run is restyled here rather than one update per card.",
@@ -20760,7 +20843,11 @@ var SEQUENCE_EDITS = /* @__PURE__ */ new Set([
20760
20843
  "groupClips",
20761
20844
  "setProximity",
20762
20845
  "setClipSpeed",
20763
- "setAutoLayout"
20846
+ "setAutoLayout",
20847
+ "setMarkers",
20848
+ "setScene",
20849
+ "setAudioMaster",
20850
+ "loopClip"
20764
20851
  ]);
20765
20852
  var EXPECTED_SEQUENCE = str(
20766
20853
  "Optional guard: the sequence id this edit is meant for (from list_sequences). If the tab has a different sequence open, the call is refused instead of editing the wrong one."
@@ -20868,7 +20955,8 @@ function toContent(result) {
20868
20955
  if (!result || typeof result !== "object") {
20869
20956
  return [{ type: "text", text: JSON.stringify(result) ?? "null" }];
20870
20957
  }
20871
- const { _image, _images, ...rest } = result;
20958
+ const { _image, _images, _file: _file2, ...rest } = result;
20959
+ if (_file2) rest.fileNote = "A file was made but this connection cannot deliver it. Use the local GoatEdit MCP server, which saves it to disk.";
20872
20960
  const blocks = [];
20873
20961
  const captions = [];
20874
20962
  for (const candidate of [_image, ...Array.isArray(_images) ? _images : []]) {
@@ -20926,6 +21014,25 @@ function findLocalFile(root, wanted, maxDepth) {
20926
21014
  return null;
20927
21015
  }
20928
21016
 
21017
+ // src/run-refs.ts
21018
+ function resolveRefs(value, refs) {
21019
+ if (typeof value === "string") {
21020
+ const m = /^\$([A-Za-z_][\w-]*)((?:\.[^.]+)*)$/.exec(value);
21021
+ if (!m || !refs.has(m[1])) return value;
21022
+ let x = refs.get(m[1]);
21023
+ for (const key of m[2].split(".").slice(1)) {
21024
+ x = x && typeof x === "object" ? x[key] : void 0;
21025
+ if (x === void 0) throw new Error(`${value}: step "${m[1]}" has no "${m[2].slice(1)}". It returned ${JSON.stringify(refs.get(m[1])).slice(0, 300)}`);
21026
+ }
21027
+ return x;
21028
+ }
21029
+ if (Array.isArray(value)) return value.map((v) => resolveRefs(v, refs));
21030
+ if (value && typeof value === "object") {
21031
+ return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, resolveRefs(v, refs)]));
21032
+ }
21033
+ return value;
21034
+ }
21035
+
20929
21036
  // src/index.ts
20930
21037
  var WEBSOCKET_PORT = 9e3;
20931
21038
  var BIND_HOST = "127.0.0.1";
@@ -21110,6 +21217,18 @@ async function handleGenerateVoiceover(text, projectId) {
21110
21217
  }
21111
21218
  }
21112
21219
  }
21220
+ function saveFileToDisk(result) {
21221
+ const file = result && typeof result === "object" ? result._file : void 0;
21222
+ if (!file || typeof file.data !== "string") return result;
21223
+ fs2.mkdirSync(FRAMES_DIR, { recursive: true });
21224
+ const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
21225
+ const safe = String(file.name ?? "file").replace(/[^\w.-]+/g, "_").slice(0, 80);
21226
+ const target = path2.join(FRAMES_DIR, `${stamp}-${safe}`);
21227
+ const bytes = Buffer.from(file.data, "base64");
21228
+ fs2.writeFileSync(target, bytes);
21229
+ const { _file: _file2, ...rest } = result;
21230
+ return { ...rest, savedTo: target, bytes: bytes.length };
21231
+ }
21113
21232
  function saveFramesToDisk(result, label) {
21114
21233
  if (!result || typeof result !== "object") return result;
21115
21234
  const frames = [result._image, ...Array.isArray(result._images) ? result._images : []].filter((f) => f && typeof f.data === "string" && typeof f.mimeType === "string");
@@ -21519,7 +21638,7 @@ var LOCAL_TOOLS = [
21519
21638
  },
21520
21639
  {
21521
21640
  name: "run_tools",
21522
- description: "Run several tool calls in order in one round trip \u2014 the fast way to make a series of edits. Stops at the first failure unless continueOnError is set, and reports each step's result. Every step sees the edits of the steps before it, but clip ids made by one step are not known when you write the list, so steps should not depend on ids that do not exist yet.",
21641
+ description: 'Run several tool calls in order in one round trip \u2014 the fast way to make a series of edits. Stops at the first failure unless continueOnError is set, and reports each step\'s result. Every step sees the edits of the steps before it. To use an id a step makes, name that step with `as` and write "$name.path" in a later step\'s args: { tool: "create_shape_clip", args: {...}, as: "bg" } then { tool: "set_keyframes", args: { clipId: "$bg.clipId", ... } }. A whole string arg is replaced; paths walk objects and arrays ("$made.clipIds.0"). With rollback, a failed run puts the whole project back as it was before the first step.',
21523
21642
  inputSchema: {
21524
21643
  type: "object",
21525
21644
  properties: {
@@ -21530,12 +21649,14 @@ var LOCAL_TOOLS = [
21530
21649
  type: "object",
21531
21650
  properties: {
21532
21651
  tool: { type: "string", description: "Tool name, e.g. move_clip." },
21533
- args: { type: "object", description: "That tool's arguments." }
21652
+ args: { type: "object", description: 'That tool\'s arguments. A string "$name.path" is replaced by that value from an earlier step named `name`.' },
21653
+ as: { type: "string", description: "Name this step's result so later steps can refer to it." }
21534
21654
  },
21535
21655
  required: ["tool"]
21536
21656
  }
21537
21657
  },
21538
- continueOnError: { type: "boolean", description: "Run the remaining steps after one fails." }
21658
+ continueOnError: { type: "boolean", description: "Run the remaining steps after one fails." },
21659
+ rollback: { type: "boolean", description: "Take a checkpoint first and restore it if any step fails, so a run either lands whole or not at all. Cannot be combined with continueOnError." }
21539
21660
  },
21540
21661
  required: ["calls"]
21541
21662
  }
@@ -21589,7 +21710,8 @@ async function callTool(name, args) {
21589
21710
  const target = projectId ?? chosenProjectId;
21590
21711
  if (name === "import_local_file") return importLocalFile(forwarded, target);
21591
21712
  const result = await sendToBrowser(tool.method, forwarded, target);
21592
- return saveToDisk ? saveFramesToDisk(result, name) : result;
21713
+ const withFile = saveFileToDisk(result);
21714
+ return saveToDisk ? saveFramesToDisk(withFile, name) : withFile;
21593
21715
  }
21594
21716
  async function importLocalFile(args, target) {
21595
21717
  const local = await callLocal("find_local_file", { filename: args.filename }, target).catch((err) => {
@@ -21612,14 +21734,32 @@ async function runTools(args) {
21612
21734
  if (!Array.isArray(calls) || !calls.length) {
21613
21735
  throw new McpError(ErrorCode.InvalidParams, "calls must be a non-empty array of { tool, args }.");
21614
21736
  }
21737
+ if (args.rollback && args.continueOnError) {
21738
+ throw new McpError(ErrorCode.InvalidParams, "rollback and continueOnError cannot be combined: a run that keeps going after a failure has nothing to roll back to.");
21739
+ }
21615
21740
  const results = [];
21616
21741
  const images = [];
21742
+ const refs = /* @__PURE__ */ new Map();
21617
21743
  let failed = 0;
21744
+ let checkpointId;
21745
+ if (args.rollback) {
21746
+ const made = await callTool("create_checkpoint", { name: "run_tools rollback" });
21747
+ checkpointId = made?.checkpointId;
21748
+ }
21618
21749
  for (let i = 0; i < calls.length; i++) {
21619
21750
  const step = calls[i];
21620
21751
  const tool = typeof step?.tool === "string" ? step.tool : "";
21621
21752
  try {
21622
- const raw = await callTool(tool, step.args && typeof step.args === "object" ? step.args : {});
21753
+ const stepArgs = resolveRefs(step.args && typeof step.args === "object" ? step.args : {}, refs);
21754
+ const raw = await callTool(tool, stepArgs);
21755
+ if (typeof step.as === "string" && step.as) {
21756
+ if (raw && typeof raw === "object" && !Array.isArray(raw)) {
21757
+ const { _image, _images, ...kept } = raw;
21758
+ refs.set(step.as, kept);
21759
+ } else {
21760
+ refs.set(step.as, raw);
21761
+ }
21762
+ }
21623
21763
  if (raw && typeof raw === "object" && !Array.isArray(raw)) {
21624
21764
  const { _image, _images, ...rest } = raw;
21625
21765
  for (const img of [_image, ...Array.isArray(_images) ? _images : []]) {
@@ -21638,7 +21778,21 @@ async function runTools(args) {
21638
21778
  }
21639
21779
  }
21640
21780
  }
21641
- return { ok: failed === 0, results, ...images.length ? { _images: images } : {} };
21781
+ let rolledBack;
21782
+ if (failed && checkpointId) {
21783
+ try {
21784
+ await callTool("restore_checkpoint", { checkpointId });
21785
+ rolledBack = true;
21786
+ } catch (err) {
21787
+ rolledBack = `failed: ${err?.message ?? err}. Restore ${checkpointId} with restore_checkpoint.`;
21788
+ }
21789
+ }
21790
+ return {
21791
+ ok: failed === 0,
21792
+ results,
21793
+ ...rolledBack !== void 0 ? { rolledBack } : {},
21794
+ ...images.length ? { _images: images } : {}
21795
+ };
21642
21796
  }
21643
21797
  server.setRequestHandler(CallToolRequestSchema, async (request) => {
21644
21798
  const { name, arguments: rawArgs } = request.params;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "goatedit-mcp",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "description": "Local MCP server for the GoatEdit video editor: drive your open editor tab from Claude Code or any MCP client",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",