{
  "name": "prepare-video-assets",
  "toolName": "prepare_video_assets",
  "tier": "orchestration",
  "category": "authoring",
  "title": "Video Asset Preparation",
  "description": "Resolves and generates every asset (image / audio / video) referenced by a Video DSL, persists a RenderPlan to the database, and returns a job_id for the subsequent render_video call. This is Phase 1 of the two-phase video pipeline; Phase 3 (Remotion render) lives in render_video.",
  "auth": "required",
  "createsTake": true,
  "envVars": [
    "PRIV_TOKEN",
    "MM_API_BASE_URL",
    "MM_BACKEND_API_URL",
    "AGENT_NAME",
    "REMOTION_RENDER_API_URL",
    "REMOTION_RENDER_MODE",
    "REMOTION_OUTPUT_DIR",
    "ASSET_CACHE_DIR"
  ],
  "scriptPath": "scripts/prepare_video_assets.py",
  "parameters": {
    "type": "object",
    "properties": {
      "dsl_json": {
        "type": "string",
        "description": "DSL JSON as an inline string (preferred — no disk write needed; required for multi-user concurrent flows). Pass the full DSL JSON, or — when a gen_script skeleton is cached in the session — a minimal JSON with only scenes[].audio.narration.text overrides (the agent layer merges narration onto the cached skeleton)."
      },
      "dsl": {
        "type": "string",
        "description": "DSL file path (legacy fallback; prefer dsl_json inline)."
      },
      "template_id": {
        "type": "string",
        "description": "Template id. When provided, the script invokes template-registry internally; no separate binding step is needed."
      },
      "binding_json": {
        "type": "string",
        "description": "TemplateBinding JSON as an inline string (alternative to template_id; no file needed)."
      },
      "binding": {
        "type": "string",
        "description": "TemplateBinding file path (optional; auto-generated when template_id is provided)."
      },
      "save_job": {
        "type": "boolean",
        "description": "Persist the RenderPlan to the database (default true). On success the stdout contains '📦 render job jobId: N'. Auto-degrades to false when PRIV_TOKEN is missing, falling back to file mode. Pass false to opt out explicitly."
      },
      "stub_image_url": {
        "type": "string",
        "description": "Test-mode image stub URL (renderer-side short-circuit). Only pass when the user explicitly says things like 'just testing / don't actually generate / use a placeholder image / save credits' AND provides a concrete URL. With this set, every image+source=gen-image AssetRef is short-circuited to that URL with no gen-image call. Do not pass otherwise; if the user expressed the intent without a URL, ask for one — do not invent one."
      },
      "stub_video_url": {
        "type": "string",
        "description": "Test-mode video stub URL (renderer-side short-circuit). Only pass when the user explicitly says things like 'just testing / don't actually generate the video / use a placeholder clip / save credits' AND provides a concrete URL. With this set, every video+source=gen-video AssetRef is short-circuited to that URL with no gen-video call. Do not pass otherwise; if the user expressed the intent without a URL, ask for one — do not invent one."
      }
    },
    "required": []
  }
}
