--- title: API Reference — Agentic MCP Tools description: Documentation of the MCP tools exposed by src/agentic/operations and src/adapters/mcp. Purpose, inputs, outputs, and an example for each. --- # Agentic MCP Tools API Every tool in this document is registered by `src/mcp-server.ts` via the `@modelcontextprotocol/sdk` `McpServer`. Tools are grouped by their registration file under `src/adapters/mcp/`. All tools return an MCP `text`/`image` content object; the `errorResponse` helper is used for failures (except where a tool intentionally returns a "blocked" text message, e.g. the gate). > **Convention:** `out` is always optional. When omitted, the tool writes into > `output/…` (or the job workspace) and returns the produced path. Successful tools return > `textResponse("-> \n")`; mutating tools are guarded by > `assertSafeMutationAllowed('mcp', …)`. --- ## 1. Operations Tools — `register-operations-tools.ts` These expose the single-task operations layer (`src/agentic/operations/*`). Each does exactly one thing and is re-verified post-render. ### `do_task` Natural-language router. Classifies a plain request and runs only the matching single task (or a 2–3 step chain split on "then"/"after that"). No paid key needed. - **Inputs:** `prompt: string` (required), `files?: string[]`, `out?: string`, `voice?: string`, `orientation?: 'portrait' | 'landscape'` - **Output:** text result (`{summary}\n{detail}`) + primary output path. - **Example:** ```json { "prompt": "crop to 9:16 then add music ambient lofi", "files": ["input/clip.mp4"] } ``` ### `merge_videos` Concatenate two or more videos into one. - **Inputs:** `files: string[]` (min 2), `out?: string`, `orientation?: 'portrait'|'landscape'` (default `portrait`) - **Output:** `EditResult` → text `-> \n` - **Example:** `{ "files": ["a.mp4","b.mp4"], "out": "merged.mp4" }` ### `trim_video` Cut a clip to `[start, end]` seconds. - **Inputs:** `file: string`, `out?: string`, `start: number` (default 0), `end?: number` - **Example:** `{ "file": "a.mp4", "start": 2, "end": 10 }` ### `crop_video` Crop to a target aspect. - **Inputs:** `file: string`, `out?: string`, `preset?: '9:16'|'16:9'|'1:1'` - **Example:** `{ "file": "a.mp4", "preset": "9:16" }` ### `resize_video` Scale to W×H (h = -2 keeps aspect ratio). - **Inputs:** `file: string`, `out?: string`, `w: number` (default 720), `h: number` (default -2) - **Example:** `{ "file": "a.mp4", "w": 1080, "h": 1080 }` ### `rotate_video` Rotate 90/180/270 degrees. - **Inputs:** `file: string`, `out?: string`, `deg: '90'|'180'|'270'` (default `'90'`) - **Example:** `{ "file": "a.mp4", "deg": "90" }` ### `extract_audio` Pull the audio track out of a video as mp3. - **Inputs:** `file: string`, `out?: string` - **Example:** `{ "file": "a.mp4", "out": "a.mp3" }` ### `split_video` Split into N equal parts, or at explicit marks (seconds). - **Inputs:** `file: string`, `parts?: number`, `marks?: number[]`, `out?: string` - **Example:** `{ "file": "a.mp4", "parts": 3 }` or `{ "file": "a.mp4", "marks": [5, 12] }` ### `add_captions` Burn captions from text or an existing `.srt`. - **Inputs:** `file: string`, `text?: string`, `srt?: string`, `out?: string` - **Example:** `{ "file": "a.mp4", "text": "Hello world" }` ### `add_music` Add a free background music track under the video (auto-ducked). - **Inputs:** `file: string`, `query?: string` (default `'ambient lofi'`), `out?: string` - **Example:** `{ "file": "a.mp4", "query": "cinematic epic" }` ### `add_audio_track` Mux a user-supplied audio (voiceover/narration) onto a video. - **Inputs:** `file: string`, `audio: string`, `volume: number` (default 1.0), `out?: string` - **Example:** `{ "file": "a.mp4", "audio": "vo.mp3", "volume": 1.0 }` ### `localize_video` Produce translated subtitle sidecars (`es/fr/hi/ta/…`). Uses free-model translation with offline fallback to original text. - **Inputs:** `file?: string`, `text?: string`, `languages: string[]`, `outDir?: string` - **Example:** `{ "text": "Welcome to the channel", "languages": ["es","hi"] }` ### `grade_video` Apply a cinematic color grade. - **Inputs:** `file: string`, `preset: 'cinematic'|'vivid'|'neon'|'teal-orange'|'bleach-bypass'|'neutral'|'warm'|'cool'` (default `'cinematic'`), `out?: string` - **Example:** `{ "file": "a.mp4", "preset": "neon" }` ### `slow_motion` Slow the whole clip by a factor (2 = half speed). - **Inputs:** `file: string`, `factor: number` (default 2), `out?: string` - **Example:** `{ "file": "a.mp4", "factor": 2 }` ### `speed_ramp` Slow a middle window of the clip, normal elsewhere. - **Inputs:** `file: string`, `rampStart: number` (default 1), `rampEnd: number` (default 3), `slowFactor: number` (default 3), `out?: string` - **Example:** `{ "file": "a.mp4", "rampStart": 1, "rampEnd": 3, "slowFactor": 3 }` ### `add_watermark` Burn a corner watermark/logo text. - **Inputs:** `file: string`, `label: string` (default `'MyBrand'`), `out?: string` - **Example:** `{ "file": "a.mp4", "label": "MyBrand" }` ### `add_lower_third` Burn a lower-third name/title bar. - **Inputs:** `file: string`, `text: string` (default `'Title'`), `out?: string` - **Example:** `{ "file": "a.mp4", "text": "Host Name" }` ### `add_progress_bar` Burn a progress bar at the bottom of a video. - **Inputs:** `file: string`, `out?: string` - **Example:** `{ "file": "a.mp4" }` ### `derive_outputs` Produce 9:16 / 16:9 / 1:1 versions + a thumbnail from an existing video. - **Inputs:** `file: string`, `aspects: ('9:16'|'16:9'|'1:1')[]` (default all three), `thumbnail: boolean` (default true), `outDir?: string` - **Example:** `{ "file": "a.mp4", "aspects": ["9:16","1:1"], "thumbnail": true }` ### `make_voiceover` Generate an mp3 voiceover from text using the configured TTS provider (default: Voicebox/Kokoro). - **Inputs:** `text: string` (min 1, `;` or newline splits lines), `voice?: string`, `out?: string` - **Example:** `{ "text": "Hello world; Welcome to my video", "voice": "af_sky" }` ### `download_image` Fetch a free CC image for a keyword. - **Inputs:** `keyword: string` (min 1), `out?: string` - **Example:** `{ "keyword": "coffee cup" }` ### `download_video` Fetch a free CC video for a keyword. - **Inputs:** `keyword: string` (min 1), `out?: string` - **Example:** `{ "keyword": "city timelapse" }` ### `remove_silence` Detect and remove silence segments from an audio/video file. - **Inputs:** `file: string`, `out?: string` - **Example:** `{ "file": "a.mp4" }` ### `detect_scenes` Detect scene changes in a video and return timestamps. - **Inputs:** `file: string` - **Example:** `{ "file": "a.mp4" }` ### `auto_reframe` Auto-reframe a video to a target aspect ratio (9:16/16:9/1:1) with subject-aware cropping. - **Inputs:** `file: string`, `preset: '9:16'|'16:9'|'1:1'`, `out?: string` - **Example:** `{ "file": "a.mp4", "preset": "9:16" }` ### `reduce_noise` Reduce background noise from an audio track. - **Inputs:** `file: string`, `strength?: number` (default 0.5), `out?: string` - **Example:** `{ "file": "a.mp4", "strength": 0.7 }` ### `apply_brand_kit` Apply a brand kit overlay (logo, colors, fonts) to a video. - **Inputs:** `file: string`, `out?: string` - **Example:** `{ "file": "a.mp4" }` --- ## 2. Agentic Pipeline Tools — `register-agentic-tools.ts` The "agent has complete control" surface over the six stages. `agentic_run` is the one-shot end-to-end path. ### `agentic_plan` (STAGE 1) Turn a script into a director plan (scenes + music query). - **Inputs:** `jobId: string`, `title: string`, `script: string` (min 10), `orientation?: 'portrait'|'landscape'` (default `portrait`), `voice?: string`, `musicQuery?: string` - **Output:** text `Planned N scenes. Music query: "…". orientation=…` - **Example:** `{ "jobId": "job_1", "title": "Coffee Facts", "script": "Did you know coffee… [Visual: espresso machine]" }` ### `agentic_acquire` (STAGE 2) Download candidate images/videos/music into per-type folders. - **Inputs:** `jobId: string`, `candidatesPerAsset: number` (1–5, default 2) - **Output:** text `Acquired N candidates into .` - **Example:** `{ "jobId": "job_1", "candidatesPerAsset": 2 }` ### `agentic_verify_all` (STAGE 3) Run the full verification matrix on all candidates. - **Inputs:** `jobId: string` - **Output:** text ` pass, fail. Details in verification/*.json.` - **Example:** `{ "jobId": "job_1" }` ### `list_pending_assets` Show every candidate + its verification score for agent review (markdown table). - **Inputs:** `jobId: string` - **Example:** `{ "jobId": "job_1" }` ### `get_asset_preview` Return a base64 thumbnail/frame so the agent can *see* the asset. - **Inputs:** `jobId: string`, `assetId: string` (e.g. `image_s0_c1`) - **Output:** MCP `image` content (`data` base64, `mimeType: image/jpeg`) - **Example:** `{ "jobId": "job_1", "assetId": "image_s0_c1" }` ### `approve_asset` / `reject_asset` Agent approves/rejects a candidate (full control). `reject_asset` triggers a re-fetch via the gateway. - **Inputs:** `jobId: string`, `assetId: string`, `rationale?: string` - **Example:** `{ "jobId": "job_1", "assetId": "image_s0_c1", "rationale": "good composition" }` ### `agentic_revise` Revise a rendered video with AI feedback. The agent re-examines the rendered output and suggests improvements (re-cut, regrade, re-voice, etc.). - **Inputs:** `jobId: string`, `feedback?: string` - **Example:** `{ "jobId": "job_1", "feedback": "Make it shorter and add more transitions" }` ### `agentic_critique` Run AI critique on a rendered video, analyzing pacing, visual quality, audio quality, and caption readability. - **Inputs:** `jobId: string` - **Example:** `{ "jobId": "job_1" }` ### `agentic_gate` (STAGE 5) Run the final holistic gate (X1–X6). Blocks render if anything unverified. - **Inputs:** `jobId: string` - **Output:** `GATE PASS. Render manifest ready (N assets).` or `errorResponse` listing failed checks `X