Skip to main content
Glama

generate_video

Create videos from text prompts using AI models, returning a URL to the generated content with customizable aspect ratio and duration.

Instructions

Generate a video using Pollinations API. Returns a URL to the generated video.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesText prompt for video generation
modelNoModel ID (default: grok-video)grok-video
aspect_ratioNoAspect ratio1:1
durationNoDuration in seconds (model-dependent)
seedNoSeed for reproducibility

Implementation Reference

  • Handler for the 'generate_video' tool, constructing the request URL for the Pollinations API.
    export async function handleGenerateVideo(
      args: z.infer<typeof generateVideoSchema>
    ) {
      const model = getModel(args.model);
      if (!model || model.type !== "video") {
        return {
          content: [
            {
              type: "text" as const,
              text: `Unknown video model: ${args.model}. Use list_models to see available models.`,
            },
          ],
          isError: true,
        };
      }
      if (!model.free && !API_KEY) {
        return {
          content: [
            {
              type: "text" as const,
              text: `Model "${args.model}" requires a Pollinations API key. Set POLLINATIONS_API_KEY env variable.`,
            },
          ],
          isError: true,
        };
      }
    
      const params = new URLSearchParams({
        model: args.model,
        aspectRatio: args.aspect_ratio,
        nologo: "true",
      });
      if (args.duration !== undefined) params.set("duration", String(args.duration));
      if (args.seed !== undefined) params.set("seed", String(args.seed));
      if (API_KEY) params.set("token", API_KEY);
    
      const encodedPrompt = encodeURIComponent(args.prompt);
      const url = `https://gen.pollinations.ai/video/${encodedPrompt}?${params}`;
    
      return {
        content: [
          {
            type: "text" as const,
            text: [
              `Video generation started!`,
              `Model: ${model.name}`,
              `Aspect ratio: ${args.aspect_ratio}`,
              `URL: ${url}`,
              `Note: Video generation may take 30-120 seconds. Open the URL in a browser to download.`,
            ].join("\n"),
          },
        ],
      };
    }
  • Zod schema definition for 'generate_video' input parameters.
    export const generateVideoSchema = z.object({
      prompt: z.string().describe("Text prompt for video generation"),
      model: z.string().default("grok-video").describe("Model ID (default: grok-video)"),
      aspect_ratio: z
        .enum(["1:1", "16:9", "9:16"])
        .default("1:1")
        .describe("Aspect ratio"),
      duration: z.number().optional().describe("Duration in seconds (model-dependent)"),
      seed: z.number().optional().describe("Seed for reproducibility"),
    });
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool generates a video and returns a URL, but lacks details on permissions, rate limits, costs, error handling, or processing time. This is inadequate for a tool that likely involves external API calls and resource consumption.

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

Conciseness5/5

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

The description is extremely concise with two sentences that directly state the tool's function and output. It is front-loaded and wastes no words, making it easy to parse quickly.

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, no annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like API dependencies, potential failures, or output details beyond a URL. For a tool with 5 parameters and external integration, more context is needed to guide effective use.

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%, so the schema fully documents all parameters. The description adds no additional meaning beyond what's in the schema, such as examples or constraints. Baseline 3 is appropriate as the schema handles parameter documentation, but the description doesn't enhance understanding.

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 a video using Pollinations API' specifies the verb (generate) and resource (video), and 'Returns a URL to the generated video' indicates the output. However, it doesn't explicitly differentiate from sibling tools like generate_image or generate_audio beyond the resource type, missing specific distinctions about when to choose video over other generation tools.

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?

No guidance is provided on when to use this tool versus alternatives. The description mentions the Pollinations API but doesn't specify contexts, prerequisites, or exclusions. Sibling tools like generate_image or generate_audio are not referenced, leaving the agent without direction on tool selection.

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/doctorm333/promptpilot-mcp-server'

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