Skip to main content
Glama

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
NameRequiredDescriptionDefault
task_idYesTask ID returned by the image-to-video tool

Implementation Reference

  • 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}`
              }
            ]
          };
        }
      }
  • 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",

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/el-el-san/vidu-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server