Skip to main content
Glama
xujfcn
by xujfcn

generate_video

Create AI-generated videos from text prompts using models like Sora 2, Kling V2, Veo 3, and Pika through the Crazyrouter MCP server.

Instructions

Generate videos using AI models via Crazyrouter. Supports Sora 2, Kling V2, Veo 3, Seedance, Pika, and more.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesText description of the video to generate
modelNoVideo generation model to use (default: kling-v2-1). Options: sora-2, kling-v2-1, veo3, doubao-seedance-1-5-pro_720p, pika-1.5, runway-vip-video, MiniMax-Hailuo-2.3kling-v2-1

Implementation Reference

  • The handler function for the generate_video tool, which makes a POST request to an API endpoint to initiate video generation.
    async ({ prompt, model }) => {
      try {
        const body: Record<string, unknown> = {
          model,
          messages: [{ role: "user", content: prompt }],
        };
    
        const result = (await apiRequest("/chat/completions", {
          method: "POST",
          body,
        })) as { choices?: Array<{ message?: { content?: string } }>; video_url?: string };
    
        const content = result.choices?.[0]?.message?.content ?? "Video generation initiated.";
        const videoUrl = result.video_url;
    
        let text = `🎬 Video generation with ${model}:\n\n`;
        if (videoUrl) text += `**Video URL:** ${videoUrl}\n\n`;
        text += content;
    
        return { content: [{ type: "text" as const, text }] };
      } catch (error) {
        const message = error instanceof Error ? error.message : "Unknown error occurred";
        return { content: [{ type: "text" as const, text: `Error: ${message}` }], isError: true };
      }
    }
  • src/index.ts:277-312 (registration)
    The MCP tool registration for 'generate_video', defining the tool's name, description, and input schema.
    server.tool(
      "generate_video",
      "Generate videos using AI models via Crazyrouter. Supports Sora 2, Kling V2, Veo 3, Seedance, Pika, and more.",
      {
        prompt: z.string().describe("Text description of the video to generate"),
        model: z
          .string()
          .default(DEFAULT_VIDEO_MODEL)
          .describe(`Video generation model to use (default: ${DEFAULT_VIDEO_MODEL}). Options: sora-2, kling-v2-1, veo3, doubao-seedance-1-5-pro_720p, pika-1.5, runway-vip-video, MiniMax-Hailuo-2.3`),
      },
      async ({ prompt, model }) => {
        try {
          const body: Record<string, unknown> = {
            model,
            messages: [{ role: "user", content: prompt }],
          };
    
          const result = (await apiRequest("/chat/completions", {
            method: "POST",
            body,
          })) as { choices?: Array<{ message?: { content?: string } }>; video_url?: string };
    
          const content = result.choices?.[0]?.message?.content ?? "Video generation initiated.";
          const videoUrl = result.video_url;
    
          let text = `🎬 Video generation with ${model}:\n\n`;
          if (videoUrl) text += `**Video URL:** ${videoUrl}\n\n`;
          text += content;
    
          return { content: [{ type: "text" as const, text }] };
        } catch (error) {
          const message = error instanceof Error ? error.message : "Unknown error occurred";
          return { content: [{ type: "text" as const, text: `Error: ${message}` }], isError: true };
        }
      }
    );
  • The input schema for 'generate_video', defining the 'prompt' and 'model' parameters.
    {
      prompt: z.string().describe("Text description of the video to generate"),
      model: z
        .string()
        .default(DEFAULT_VIDEO_MODEL)
        .describe(`Video generation model to use (default: ${DEFAULT_VIDEO_MODEL}). Options: sora-2, kling-v2-1, veo3, doubao-seedance-1-5-pro_720p, pika-1.5, runway-vip-video, MiniMax-Hailuo-2.3`),
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'Generate videos using AI models' and lists models, but doesn't describe what the tool actually does behaviorally—e.g., whether it initiates an async process, returns a video file or URL, requires authentication, has rate limits, or involves costs. For a tool with zero annotation coverage, this is a significant gap, warranting a score of 2.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded, stating the core purpose in the first phrase. The list of models adds specificity without unnecessary elaboration. However, the second sentence could be integrated more smoothly, and there's some redundancy with the schema's model options, slightly reducing efficiency. Overall, it's appropriately sized with minimal waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of video generation (likely involving async processing, output formats, etc.), no annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., a video URL, status, or error details), behavioral aspects like latency or costs, or how to handle the generated content. This inadequacy for a tool with such potential complexity results in a score of 2.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with both parameters ('prompt' and 'model') well-described in the schema. The description adds no additional meaning about parameters beyond implying model options in its list. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description doesn't compensate or add value beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Generate videos using AI models via Crazyrouter.' It specifies the action ('Generate videos') and resource ('AI models'), and lists specific models (Sora 2, Kling V2, etc.) to illustrate capability. However, it doesn't explicitly differentiate from sibling tools like 'generate_image' beyond implying video vs. image generation, which is why it's a 4 rather than a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'generate_image' or 'chat'. It lists supported models but doesn't indicate when to choose one model over another or any prerequisites for usage. This lack of explicit when/when-not/alternatives guidance results in a score of 2.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/xujfcn/crazyrouter-mcp'

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