check-generation-status
Monitor the progress of video generation tasks on Vidu MCP Server by providing the task ID. Ensure timely status updates for seamless workflow management.
Instructions
Check the status of a video generation task
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | Yes | Task ID returned by the image-to-video tool |
Implementation Reference
- index.ts:294-397 (handler)Handler function for the 'check-generation-status' tool that performs an API call to check the task status, handles success/failure/in-progress states, extracts video URLs and credits, and returns formatted markdown text responses.async ({ task_id }) => { try { const statusResponse = await fetch(`${VIDU_API_BASE_URL}/ent/v2/tasks/${task_id}/creations`, { method: "GET", headers: { "Content-Type": "application/json", "Authorization": `Token ${VIDU_API_KEY}` } }); if (!statusResponse.ok) { const errorData = await statusResponse.text(); return { isError: true, content: [ { type: "text", text: `Error checking generation status: ${errorData}` } ] }; } const statusData = await statusResponse.json() as StatusResponse; if (statusData.state === "success") { if (statusData.creations && statusData.creations.length > 0) { const videoUrl = statusData.creations[0].url; const coverUrl = statusData.creations[0].cover_url; const credits = statusData.credits; return { content: [ { type: "text", text: ` Generation task complete! Task ID: ${task_id} Status: ${statusData.state} Credits used: ${credits || 'N/A'} Video URL: ${videoUrl} Cover Image URL: ${coverUrl} Note: These URLs are valid for one hour. ` } ] }; } else { return { content: [ { type: "text", text: ` Generation task complete but no download URLs available. Task ID: ${task_id} Status: ${statusData.state} ` } ] }; } } else if (statusData.state === "failed") { return { isError: true, content: [ { type: "text", text: `Generation task failed with error code: ${statusData.err_code || "Unknown error"}` } ] }; } else { return { content: [ { type: "text", text: ` Generation task is still in progress. Task ID: ${task_id} Current Status: ${statusData.state} You can check again later using the same task ID. ` } ] }; } } catch (error: any) { console.error("Error in check-generation-status tool:", error); return { isError: true, content: [ { type: "text", text: `An unexpected error occurred: ${error.message}` } ] }; } }
- index.ts:291-293 (schema)Zod input schema defining the required 'task_id' parameter for the tool.{ task_id: z.string().describe("Task ID returned by the image-to-video tool") },
- index.ts:288-290 (registration)Registration of the 'check-generation-status' tool on the MCP server, including name, description, schema, and inline handler.server.tool( "check-generation-status", "Check the status of a video generation task",