Skip to main content
Glama

Magic replace video

var2_magic_replace

Magic Replacer — edit an EXISTING video clip, keeping its motion. Engine: Seedance 2.5 (default), MiniMax Hailuo 3 (engine: "minimax-h3") or MAGI-2 (engine: "magi-2"). Three modes: swap (Object Swap) replaces ONE named element — a product, person, outfit or prop — with what the reference image shows and keeps everything else (e.g. "put my serum bottle in her hand instead of the coffee cup", "replace the man in the red jacket with this character", "change her dress to this outfit"). transfer (Motion Transfer) keeps ONLY the motion, camera and timing and rebuilds cast + world from the references (e.g. "same dance, but this character on a beach"; keep_location=true keeps the original place). restyle keeps the people and motion and re-renders the look in a preset (e.g. "make this video anime / claymation / noir"). Use THIS tool whenever the input is an existing clip and the ask is replace / swap / recast / restyle. Use var2_create_video instead for NEW footage (text/image/reference-to-video), wan-2.7 for a free-form prompt edit of a clip, and ltx-retake to redo only a time range of a clip. Limits — seedance-2-5: source 4–30s, ≤8 reference images, 480p | 720p (default 720p), sound optional, billed per output second (= source seconds). minimax-h3: source 4–15s at 24–60 fps, ≤9 reference images (each beyond 5 costs extra), 768P | 2K (default 768P), always generates sound, billed per second of output + source clip. magi-2: source 4–30s, ≤10 reference images, 1080p only, sound optional, billed per output second (the clip and images are free) — it re-renders from the references, so swaps are looser than on the default engine. Trim longer clips first; output length and aspect ratio follow the source; upscale afterwards for more resolution. Do not pass a duration — the server measures the clip. Use the default engine unless the user asks for MiniMax / Hailuo / H3 or 2K output, or for MAGI-2 / 1080p. Tips: character refs work best as a clean full-body photo or a multi-angle character sheet on a plain background (make one first with var2_create_image, model gpt-image-2, character-sheet prompt). In swap mode name the target concretely ("the blue mug on the desk") — or call first with analyze_only=true (free) to get the detected subjects with ids like "s2" plus a credit quote, then pass target:"s2". The scene analysis is saved per clip, so later calls on the same video_url reuse it instantly and the subject ids stay the same. For a cost estimate without analysis use var2_estimate_cost with model_id "magic-replacer", type "video-to-video", params {duration:, resolution, engine}. Returns a video placeholder (poll with var2_get_video_result). Reply in ONE short sentence + the share link; do not narrate tool calls.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "mode": "<mode>",
      "video_url": "<video_url>"
    },
    "name": "var2_magic_replace"
  }
}

Input Schema

NameRequiredDescriptionDefault
modeYesswap = replace one element, keep the rest. transfer = keep only motion/camera/timing, new cast + world from references. restyle = same people + motion, new look (needs preset, a style reference or an instruction).
engineNoRender engine. seedance-2-5 (default): 4–30s clips, 480p/720p, sound optional. minimax-h3 (MiniMax Hailuo 3): 4–15s clips at 24–60 fps, up to 9 reference images, 768P/2K, always with sound. magi-2 (MAGI-2): 4–30s clips, up to 10 reference images, 1080p, sound optional, billed per output second only.
presetNoStyle preset for restyle (and optionally transfer).
targetNoswap: what to replace — a concrete description ("the coffee cup in her right hand") or a subject id from analyze_only ("s2"). Required for swap unless a reference has `replaces` or the instruction says it.
analysisNoOptional and rarely needed: the `analysis` object from a previous analyze_only call for the SAME video_url, passed back verbatim. The server already saves each clip's analysis and reuses it automatically.
video_urlYesSource clip, 4–30s MP4/MOV (4–15s on minimax-h3), var2-hosted: storage URL, var2 share link (www.var2.ai/video/<id>) or placeholder_id — auto-resolved. Third-party links (dropbox/CDN/etc.): import first with var2_upload_asset (url); local files: upload first.
referencesNoRich form: reference images (combined with reference_image_urls — up to 8 on seedance-2-5, 9 on minimax-h3, 10 on magi-2), each with a role, optional label and what it replaces. swap and transfer need at least one.
resolutionNoseedance-2-5: 480p | 720p (default 720p; 480p costs less than half). minimax-h3: 768P | 2K (default 768P). magi-2: 1080p only.
instructionNoOptional free-text direction appended to the compiled prompt (e.g. "she smiles at the end", "golden-hour light").
webhook_urlNoOptional. https:// URL var2 POSTs a signed delivery to when the asset is ready (or fails). Signature header: X-VAR2-Signature: t=<unix>, v1=<hex(hmac_sha256(webhook_secret, t + "." + body))>. Retried with exponential backoff (8 attempts over ~4 days).
analyze_onlyNotrue = FREE pre-flight: measure the clip, list detected subjects (ids like "s1") and shots, report blocking issues and quote credits per resolution. Nothing is generated or charged. Use it when the swap target is ambiguous or the user asks what it would cost.
keep_locationNotransfer only: keep the source video's real location instead of rebuilding it. Default false.
generate_audioNoDefault true — keep / regenerate the clip's audio, dialogue and lip-sync timing. false = silent output.
idempotency_keyNoOptional. Retries with the same key never double-bill (dedupes on ai_jobs.request_id). Use a stable per-user-action value (e.g. a UUID).
reference_image_urlsNoSimple form: reference image URLs, each given the default role for the mode. Use `references` instead when images play different roles.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed8 schema fields changed
    • changedInput schema / properties / engine / description
      Previous value: -"Render engine. seedance-2-5 (default): 4–30s clips, 480p/720p, sound optional. minimax-h3 (MiniMax Hailuo 3): 4–15s clips at 24–60 fps, up to 9 reference images, 768P/2K, always with sound."New value: +"Render engine. seedance-2-5 (default): 4–30s clips, 480p/720p, sound optional. minimax-h3 (MiniMax Hailuo 3): 4–15s clips at 24–60 fps, up to 9 reference images, 768P/2K, always with sound. magi-2 (MAGI-2): 4–30s clips, up to 10 reference images, 1080p, sound optional, billed per output second only."
    • changedInput schema / properties / engine / enum
      Previous value: -[
      -  "seedance-2-5",
      -  "minimax-h3"
      -]New value: +[
      +  "seedance-2-5",
      +  "minimax-h3",
      +  "magi-2"
      +]
    • changedInput schema / properties / reference_image_urls / maxItems
      Previous value: -9New value: +10
    • changedInput schema / properties / references / description
      Previous value: -"Rich form: reference images (combined with reference_image_urls — up to 8 on seedance-2-5, 9 on minimax-h3), each with a role, optional label and what it replaces. swap and transfer need at least one."New value: +"Rich form: reference images (combined with reference_image_urls — up to 8 on seedance-2-5, 9 on minimax-h3, 10 on magi-2), each with a role, optional label and what it replaces. swap and transfer need at least one."
    • changedInput schema / properties / references / maxItems
      Previous value: -9New value: +10
    • changedInput schema / properties / resolution / description
      Previous value: -"seedance-2-5: 480p | 720p (default 720p; 480p costs less than half). minimax-h3: 768P | 2K (default 768P)."New value: +"seedance-2-5: 480p | 720p (default 720p; 480p costs less than half). minimax-h3: 768P | 2K (default 768P). magi-2: 1080p only."
    • changedInput schema / properties / resolution / enum
      Previous value: -[
      -  "480p",
      -  "720p",
      -  "768P",
      -  "2K"
      -]New value: +[
      +  "480p",
      +  "720p",
      +  "768P",
      +  "2K",
      +  "1080p"
      +]
    • changedInput schema / properties / video_url / description
      Previous value: -"Source clip, 4–30s MP4/MOV, var2-hosted: storage URL, var2 share link (www.var2.ai/video/<id>) or placeholder_id — auto-resolved. Third-party links (dropbox/CDN/etc.): import first with var2_upload_asset (url); local files: upload first."New value: +"Source clip, 4–30s MP4/MOV (4–15s on minimax-h3), var2-hosted: storage URL, var2 share link (www.var2.ai/video/<id>) or placeholder_id — auto-resolved. Third-party links (dropbox/CDN/etc.): import first with var2_upload_asset (url); local files: upload first."
  2. Changed1 schema field changed
    • changedInput schema / properties / analysis / description
      Previous value: -"Optional: the `analysis` object returned by a previous analyze_only call for the SAME video_url, passed back verbatim to skip a second scene scan."New value: +"Optional and rarely needed: the `analysis` object from a previous analyze_only call for the SAME video_url, passed back verbatim. The server already saves each clip's analysis and reuses it automatically."
  3. Changed6 schema fields changed
    • addedInput schema / properties / engine
      Added value: +{
      +  "description": "Render engine. seedance-2-5 (default): 4–30s clips, 480p/720p, sound optional. minimax-h3 (MiniMax Hailuo 3): 4–15s clips at 24–60 fps, up to 9 reference images, 768P/2K, always with sound.",
      +  "enum": [
      +    "seedance-2-5",
      +    "minimax-h3"
      +  ],
      +  "type": "string"
      +}
    • changedInput schema / properties / reference_image_urls / maxItems
      Previous value: -8New value: +9
    • changedInput schema / properties / references / description
      Previous value: -"Rich form: up to 8 reference images (combined with reference_image_urls), each with a role, optional label and what it replaces. swap and transfer need at least one."New value: +"Rich form: reference images (combined with reference_image_urls — up to 8 on seedance-2-5, 9 on minimax-h3), each with a role, optional label and what it replaces. swap and transfer need at least one."
    • changedInput schema / properties / references / maxItems
      Previous value: -8New value: +9
    • changedInput schema / properties / resolution / description
      Previous value: -"Default 720p. 480p costs less than half."New value: +"seedance-2-5: 480p | 720p (default 720p; 480p costs less than half). minimax-h3: 768P | 2K (default 768P)."
    • changedInput schema / properties / resolution / enum
      Previous value: -[
      -  "480p",
      -  "720p"
      -]New value: +[
      +  "480p",
      +  "720p",
      +  "768P",
      +  "2K"
      +]
  4. Added

TDQS

A4.4/5.0
Behavior3/5

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

Annotations only mark it as a non-read-only, non-destructive, open-world call, so the description carries real weight and does deliver: per-engine clip limits, fps, reference caps, pricing basis, that output length and aspect ratio follow the source, that duration must not be passed because the server measures the clip, and that a placeholder is returned for polling. It stops short of describing failure behaviour beyond 'report blocking issues', and the parameter-level format details are largely duplicated from the schema.

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 opening sentence front-loads the verb and resource, then modes, routing, limits and tips follow in a defensible order for a 15-parameter tool. It is dense but nearly every clause carries operational information; the closing 'Reply in ONE short sentence + the share link; do not narrate tool calls' is a response-style directive that is somewhat out of place in a tool description.

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 15-parameter mutation tool with no output schema, the description covers the full lifecycle: URL/upload prerequisites, free analysis pre-flight, cost estimation path, async placeholder plus var2_get_video_result polling, and post-processing advice (trim first, upscale after). Nothing an agent needs to invoke it correctly is missing.

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 coverage is already 100%, so the baseline is 3, but the description adds genuine cross-parameter meaning: naming the swap target concretely or harvesting subject ids via a free analyze_only call, reusing the per-clip saved analysis so ids stay stable, tying engine choice to resolution options, and routing cost estimates to var2_estimate_cost with specific model_id/type/params. That is more than the schema conveys field-by-field.

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?

States a specific verb and resource — 'edit an EXISTING video clip, keeping its motion' — then enumerates the three modes with concrete examples of each. It explicitly names the sibling tools it is not (var2_create_video for new footage, wan-2.7 for free-form prompt edits, ltx-retake for time-range retakes), so an agent can route without opening any schema.

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?

Gives an explicit decision rule ('Use THIS tool whenever the input is an existing clip and the ask is replace / swap / recast / restyle'), names the alternatives and their conditions, and extends the guidance down to mode selection and engine selection ('Use the default engine unless the user asks for MiniMax / Hailuo / H3 or 2K...'). It also prescribes the analyze_only pre-flight when the target is ambiguous.

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.

Resources