openart_generate_video
Create a video of an OpenArt character speaking a provided script. Specify character, script, and aspect ratio to generate spoken animation.
Instructions
Generate a video using an existing OpenArt character speaking a script.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| character_id | Yes | ||
| script | Yes | What the character says | |
| aspect_ratio | No |
Implementation Reference
- src/tools.ts:111-140 (handler)The `generateVideo` function implements the core logic for the openart_generate_video tool. It navigates to the character's page, fills in the script, optionally selects aspect ratio, clicks Generate, waits for a video-id, and returns the job ID with status 'queued'.
export async function generateVideo(params: { character_id: string; script: string; aspect_ratio?: "9:16" | "16:9" | "1:1"; }): Promise<Video> { const page = await newPage(); try { await page.goto(`${BASE_URL}/character/${params.character_id}`); await page.waitForLoadState("networkidle"); // TODO: real selectors. await page.locator('button:has-text("Add a script")').click(); await page.locator('textarea[name="script"]').fill(params.script); if (params.aspect_ratio) { await page.locator(`[data-aspect-ratio="${params.aspect_ratio}"]`).click(); } await page.locator('button:has-text("Generate")').click(); // Wait for job ID to appear in URL or DOM await page.waitForSelector('[data-video-id]', { timeout: 60_000 }); const videoId = await page.locator('[data-video-id]').first().getAttribute("data-video-id") || ""; return { id: videoId, status: "queued", }; } finally { await page.close(); } } - src/index.ts:57-68 (schema)Registration of the openart_generate_video tool with its inputSchema defining required parameters (character_id, script) and optional aspect_ratio enum (9:16, 16:9, 1:1).
name: "openart_generate_video", description: "Generate a video using an existing OpenArt character speaking a script.", inputSchema: { type: "object", properties: { character_id: { type: "string" }, script: { type: "string", description: "What the character says" }, aspect_ratio: { type: "string", enum: ["9:16", "16:9", "1:1"] }, }, required: ["character_id", "script"], }, annotations: { destructiveHint: false, openWorldHint: true }, - src/index.ts:106-113 (registration)The switch-case in the CallToolRequestSchema handler that routes 'openart_generate_video' to the generateVideo function, with Zod parsing for validation.
case "openart_generate_video": result = await generateVideo( z.object({ character_id: z.string(), script: z.string(), aspect_ratio: z.enum(["9:16", "16:9", "1:1"]).optional(), }).parse(args) );