Skip to main content
Glama

image_to_video

Convert static images into animated videos with Ghibli-style aesthetics using AI video generation. Transform photos into motion by providing an image and optional prompts.

Instructions

Convert image to animated video

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
imageYesBase64 encoded source image or image URL
promptNoOptional prompt for video generation
aspect_ratioNoAspect ratio of the output video (e.g. '9:16')9:16
negative_promptNoNegative prompt to guide generationbad prompt
api_keyYesAPI key for authentication

Implementation Reference

  • Core handler function in GhibliClient that performs the image-to-video conversion by making a POST request to the external API (/api/video) and returns the task ID.
    async imageToVideo(
        sourceImage: string, 
        prompt: string = "in the style of ghibli", 
        aspectRatio: string = "9:16",
        negativePrompt: string = "bad prompt",
        apiKey: string
      ): Promise<string> {
        const payload = {
          prompt,
          task_type: "img2video-14b",
          negative_prompt: negativePrompt,
          aspect_ratio: aspectRatio,
          image: sourceImage
        };
    
        // 打印请求信息
        process.stderr.write(`\n[Request] POST ${this.baseUrl}/api/video\n`);
        process.stderr.write(`[Headers] ${JSON.stringify(this.getHeaders(apiKey), null, 2)}\n`);
        process.stderr.write(`[Payload] Image length: ${sourceImage.length}, Prompt: ${prompt}\n`);
    
        const response = await fetch(`${this.baseUrl}/api/video`, {
          method: 'POST',
          headers: this.getHeaders(apiKey),
          body: JSON.stringify(payload)
        });
    
        // 打印响应状态
        process.stderr.write(`[Response] Status: ${response.status} ${response.statusText}\n`);
    
        if (!response.ok) {
          const error = `API request failed: ${response.statusText}`;
          process.stderr.write(`[Error] ${error}\n`);
          throw new Error(error);
        }
    
        const result = await response.json();
        process.stderr.write(`[Response Data] ${JSON.stringify(result, null, 2)}\n`);
        return result.data?.task_id;
      }
  • src/index.ts:48-79 (registration)
    Registers the 'image_to_video' tool in the MCP server's list of available tools, defining its name, description, and input schema.
    {
      name: "image_to_video",
      description: "Convert image to animated video",
      inputSchema: {
        type: "object",
        properties: {
          image: {
            type: "string",
            description: "Base64 encoded source image or image URL"
          },
          prompt: {
            type: "string",
            description: "Optional prompt for video generation"
          },
          aspect_ratio: {
            type: "string",
            description: "Aspect ratio of the output video (e.g. '9:16')",
            default: "9:16"
          },
          negative_prompt: {
            type: "string",
            description: "Negative prompt to guide generation",
            default: "bad prompt"
          },
          api_key: {
            type: "string",
            description: "API key for authentication"
          }
        },
        required: ["image", "api_key"]
      }
    },
  • MCP CallToolRequest handler case for 'image_to_video' that extracts arguments, validates inputs, delegates to GhibliClient.imageToVideo, and formats the response.
    case "image_to_video": {
      const image = String(request.params.arguments?.image);
      const prompt = String(request.params.arguments?.prompt || "in the style of ghibli");
      const aspectRatio = String(request.params.arguments?.aspect_ratio || "9:16");
      const negativePrompt = String(request.params.arguments?.negative_prompt || "bad prompt");
      const apiKey = String(request.params.arguments?.api_key);
    
      if (!image) {
        throw new Error("Source image cannot be empty");
      }
      if (!apiKey) {
        throw new Error("API key cannot be empty");
      }
    
      try {
        const result = await ghibliClient.imageToVideo(
          image, 
          prompt, 
          aspectRatio,
          negativePrompt,
          apiKey
        );
        return {
          content: [{
            type: "text",
            text: `Video generation taskid: ${result}`
          }]
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : 'Unknown error';
        throw new Error(`Video generation failed: ${errorMessage}`);
      }
    }
  • Input schema defining the parameters for the 'image_to_video' tool, including types, descriptions, defaults, and required fields.
    inputSchema: {
      type: "object",
      properties: {
        image: {
          type: "string",
          description: "Base64 encoded source image or image URL"
        },
        prompt: {
          type: "string",
          description: "Optional prompt for video generation"
        },
        aspect_ratio: {
          type: "string",
          description: "Aspect ratio of the output video (e.g. '9:16')",
          default: "9:16"
        },
        negative_prompt: {
          type: "string",
          description: "Negative prompt to guide generation",
          default: "bad prompt"
        },
        api_key: {
          type: "string",
          description: "API key for authentication"
        }
      },
      required: ["image", "api_key"]
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. 'Convert image to animated video' implies a generative or processing operation, but it doesn't disclose critical traits like whether it's a read-only or destructive operation, authentication requirements (though hinted by api_key parameter), rate limits, or output format. For a tool with no annotations, this is a significant gap in transparency.

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 a single sentence 'Convert image to animated video', which is front-loaded and wastes no words. Every part of the sentence directly contributes to understanding the tool's purpose, making it efficient and well-structured.

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 a generative video tool with 5 parameters, no annotations, and no output schema, the description is incomplete. It lacks information on behavioral aspects, output format, error handling, and usage context. The description should do more to compensate for the absence of structured data, making it inadequate for full agent understanding.

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%, meaning all parameters are documented in the input schema. The description adds no additional meaning beyond the schema, such as explaining how parameters interact or providing usage examples. With high schema coverage, the baseline is 3, as the description doesn't compensate but also doesn't detract.

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 'Convert image to animated video' clearly states the verb ('Convert') and resource ('image to animated video'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools (get_points, get_task_result), which are unrelated to media conversion, so it doesn't need sibling differentiation but could be more specific about the type of conversion.

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. It doesn't mention prerequisites, context for use, or exclusions, leaving the agent to infer usage based on the tool name alone. This lack of explicit guidance reduces its effectiveness in 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/MichaelYangjson/mcp-ghibli-video'

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