Skip to main content
Glama
el-el-san

AI Video Generator MCP Server

by el-el-san

check-video-status

Monitor the progress of a video generation request by providing the request ID. Track status and ensure completion using AI models like Luma Ray2 or Kling.

Instructions

Check the status of a video generation request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelNoAI model used for the request (luma=Ray2, kling=Kling)luma
request_idYesThe request ID to check

Implementation Reference

  • Handler for the 'check-video-status' tool. Determines the model, validates it, calls falClient.queue.status with the requestId, processes the response to extract status, logs, and position, and returns a JSON-formatted text content response. Handles errors appropriately.
    } else if (name === "check-video-status") {
      try {
        // Determine which model to use
        const modelName = args.model || "luma";
        const modelUrl = MODELS[modelName as keyof typeof MODELS];
        
        if (!modelUrl) {
          return {
            isError: true,
            content: [
              {
                type: "text",
                text: `Invalid model: ${modelName}. Supported models are: luma, kling`
              }
            ]
          };
        }
    
        const status: any = await falClient.queue.status(modelUrl, {
          requestId: args.request_id,
          logs: true
        });
        
        // Safely extract properties
        const statusLogs = Array.isArray(status.logs) ? status.logs : [];
        const position = status.position || status.queue_position || 0;
        
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                model: modelName,
                status: status.status,
                logs: statusLogs,
                position: position
              }, null, 2)
            }
          ]
        };
      } catch (error: any) {
        return {
          isError: true,
          content: [
            {
              type: "text",
              text: `Error checking video status: ${error instanceof Error ? error.message : String(error)}`
            }
          ]
        };
      }
  • Registration and schema for 'check-video-status' tool in the ListToolsRequestSchema handler. Defines name, description, and input schema requiring 'request_id' and optional 'model'.
    {
      name: "check-video-status",
      description: "Check the status of a video generation request",
      inputSchema: {
        type: "object",
        properties: {
          request_id: {
            type: "string",
            description: "The request ID to check"
          },
          model: {
            type: "string",
            enum: ["luma", "kling"],
            default: "luma",
            description: "AI model used for the request (luma=Ray2, kling=Kling)"
          }
        },
        required: ["request_id"]
      }
    }
  • src/index.ts:40-116 (registration)
    The ListToolsRequestSchema handler where the 'check-video-status' tool is registered by including it in the tools array.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          {
            name: "generate-video",
            description: "Generate a video from text prompt and/or images using AI models (Luma or Kling)",
            inputSchema: {
              type: "object",
              properties: {
                prompt: {
                  type: "string",
                  description: "Text description of the desired video content"
                },
                image_url: {
                  type: "string",
                  description: "Initial image to start the video from (URL or base64 data URI)"
                },
                end_image_url: {
                  type: "string",
                  description: "Final image to end the video with (URL or base64 data URI)"
                },
                aspect_ratio: {
                  type: "string",
                  enum: ["16:9", "9:16", "4:3", "3:4", "21:9", "9:21"],
                  default: "16:9",
                  description: "Aspect ratio of the video"
                },
                resolution: {
                  type: "string",
                  enum: ["540p", "720p", "1080p"],
                  default: "540p",
                  description: "Resolution of the video (higher resolutions use more credits)"
                },
                duration: {
                  type: "string",
                  enum: ["5s", "9s"],
                  default: "5s",
                  description: "Duration of the video (9s costs 2x more)"
                },
                loop: {
                  type: "boolean",
                  default: false,
                  description: "Whether the video should loop (blend end with beginning)"
                },
                model: {
                  type: "string",
                  enum: ["luma", "kling"],
                  default: "luma",
                  description: "AI model to use (luma=Ray2, kling=Kling)"
                }
              },
              required: ["prompt"]
            }
          },
          {
            name: "check-video-status",
            description: "Check the status of a video generation request",
            inputSchema: {
              type: "object",
              properties: {
                request_id: {
                  type: "string",
                  description: "The request ID to check"
                },
                model: {
                  type: "string",
                  enum: ["luma", "kling"],
                  default: "luma",
                  description: "AI model used for the request (luma=Ray2, kling=Kling)"
                }
              },
              required: ["request_id"]
            }
          }
        ]
      };
    });
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/fal-mcp-server'

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