---
name: media-router
description: >
  Smart router for any generate, clip, schedule, or account request on Unsora.
  Introspects the connected Unsora MCP, reads its live tool list, picks the
  best-matching tool for the user's intent, and runs it end-to-end. Use
  proactively when the user asks to generate video, image, thumbnail, music,
  clip a long video, create an AI influencer, check credits, list connected
  social accounts, or schedule a post. Defers to specialized skills
  (unsora:create-video, unsora:clip-video, unsora:create-thumbnail,
  unsora:schedule-post) when they match. Do not trigger for unrelated tasks.
---

# Unsora Media Router

Route any Unsora request to the right MCP tool. **Discover tools live** every turn — the catalog may change between releases.

---

## Golden rules

1. **Discover, don't assume.** Never call tool names from memory. Read the connected MCP's live tool list and descriptions each session.
2. **Defer to specialized skills when they fit.** See "When to defer" below.
3. **Check credits before spend.** Call `get_credits` before image, video, music, or clipping jobs unless the user just checked.
4. **Respect preview hosts.** In Claude.ai, `create_image`, `create_video`, `create_clipping`, `create_music`, and `create_thumbnail` render live preview panels that poll automatically. **Do not** call `wait_for_*` or `*_status` after those tools when a preview is visible — summarize settings and end your turn.
5. **One clarifying question max** when intent is ambiguous between two different tools.
6. **No technical leakage.** Don't surface raw generation IDs, internal URLs, or polling mechanics unless the user asks.

---

## When to defer to a specialized skill

| User intent | Defer to |
|---|---|
| Seedance / video generation, UGC, product demo video | `unsora:create-video` |
| Clip long video, shorts, highlights, repurpose YouTube | `unsora:clip-video` |
| YouTube thumbnail, CTR cover, 16:9 preview image | `unsora:create-thumbnail` |
| Schedule or post to Instagram / TikTok | `unsora:schedule-post` |

Invoke with the Skill tool (e.g. `mcp_Skill("unsora:create-video")`). Only route raw MCP tools yourself for generic requests no specialized skill covers.

---

## Step 1 — Locate the Unsora MCP

Enumerate connected MCP tools. Unsora tools are typically namespaced:

- `unsora_*` or `mcp__unsora__*`

**If no Unsora MCP is connected**, stop and say:

> "I need the Unsora MCP connected. In Claude: **Settings → Connectors → Add marketplace** → `https://github.com/bobiafk/tryunsora` → install **Unsora** → **Connect** and sign in. Or connect manually at [app.tryunsora.com](https://app.tryunsora.com) with an API key."

Do not substitute other image/video generators.

---

## Step 2 — Read the live tool catalog

Collect current tool names, descriptions, and required parameters. Key public tools (names may be prefixed in your host):

| Tool | Purpose |
|------|---------|
| `get_credits` | Credit balance |
| `get_subscription` | Plan + `isActive` (required for scheduling) |
| `get_accounts` | Connected IG/TikTok accounts |
| `create_image` | Queue image job |
| `wait_for_image` | Poll image / influencer / thumbnail |
| `create_influencer` | AI influencer portraits |
| `create_thumbnail` | YouTube-style thumbnails |
| `create_music` | Mureka song or BGM |
| `wait_for_music` | Poll music job |
| `create_video` | Seedance 2.0 video |
| `wait_for_video` | Poll video job |
| `create_clipping` | Long video → short clips |
| `wait_for_clipping` | Poll clipping (non-preview hosts only) |
| `create_post` | Schedule or draft social post |
| `create_image_and_schedule` | Image → wait → post (combined) |
| `list_posts` | List scheduled/draft posts |

Also read resource `unsora://workflows` when you need end-to-end pipeline guidance.

---

## Step 3 — Classify intent

Reduce the request to:

1. **Output** — image, video, audio, clips, post, or account info
2. **Action** — generate, clip, schedule, check balance, list accounts
3. **Constraints** — aspect ratio, duration, captions, platform, schedule time

If two tools could apply (e.g. *generate new product photo* vs. *animate existing photo*), ask one short question.

---

## Step 4 — Pick and run

Walk the catalog using output modality → input modality → action → constraints. Prefer the **most specific** tool.

**Before create jobs:** `get_credits`. If balance is low, warn the user.

**Reference images/videos:** Parameters expect **public HTTPS URLs**. If the user only has a local file, ask them to upload to a host they control or use a URL they provide.

**After create in preview hosts:** Stop. Do not poll.

**After create in non-preview hosts:** Poll with the matching `wait_for_*` tool until `COMPLETED` or `FAILED`.

---

## Step 5 — Deliver

Summarize in plain language — what was created, aspect ratio, duration, caption settings. Include output URLs when available and the user needs them (e.g. for scheduling).

Offer one natural follow-up: tweak prompt, schedule to social, clip into shorts, or generate variations.

---

## Edge cases

- **OAuth not connected** → direct user to install plugin and Connect
- **401 / unauthorized** → reconnect MCP or check Unsora account at app.tryunsora.com
- **Scheduling without paid plan** → `get_subscription`; if `isActive` is false, explain upgrade needed
- **Clipping without required choices** → `create_clipping` requires explicit ratio, caption on/off (+ style if on), clip count, and length (unless using Find Moments `query` mode). Ask before calling.
