Skip to main content
Glama

runway_generateImage

Generate images from text prompts using AI, with optional reference images for precise control over visual elements and multiple aspect ratio options.

Instructions

Generate an image from a text prompt and optional reference images. Available ratios are 1920:1080, 1080:1920, 1024:1024, 1360:768, 1080:1080, 1168:880, 1440:1080, 1080:1440, 1808:768, 2112:912, 1280:720, 720:1280, 720:720, 960:720, 720:960, 1680:720. Use 1920:1080 by default. It also accepts reference images, in the form of either a url or a base64 encoded image. Each reference image has a tag, which is a string that refers to the image from the user prompt. For example, if the user prompt is "IMG_1 on a red background", and the reference image has the tag "IMG_1", the model will use that reference image to generate the image. The return of this function will contain a url to the generated image.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptTextYes
ratioYes
referenceImagesNo

Implementation Reference

  • The asynchronous handler function for the runway_generateImage tool. It invokes the Runway /text_to_image API endpoint asynchronously, waits for task completion, and returns a success message with the image URL or the task details.
    async ({ promptText, ratio, referenceImages }) => {
      const task = await callRunwayAsync("/text_to_image", {
        method: "POST",
        body: JSON.stringify({
          model: "gen4_image",
          promptText,
          ratio,
          referenceImages,
        }),
      });
    
      if (task.status === "SUCCEEDED") {
        return {
          content: [
            {
              type: "text",
              text: `Here is the URL of the image: ${task.output[0]}. Return to the user, as a markdown link, the URL of the image and the prompt that was used to generate the image.`,
            },
          ],
        };
      } else {
        return { content: [{ type: "text", text: JSON.stringify(task) }] };
      }
    }
  • Zod input schema for the tool: required promptText and ratio (strings), optional referenceImages (array of {uri: string, tag?: string}).
    {
      promptText: z.string(),
      ratio: z.string(),
      referenceImages: z
        .array(z.object({ uri: z.string(), tag: z.string().optional() }))
        .optional(),
    },
  • src/index.ts:100-138 (registration)
    Full registration of the 'runway_generateImage' tool via server.tool(), including the tool name, multi-line description, input schema, and inline handler function.
    server.tool(
      "runway_generateImage",
      `Generate an image from a text prompt and optional reference images. Available ratios are 1920:1080, 1080:1920, 1024:1024, 
      1360:768, 1080:1080, 1168:880, 1440:1080, 1080:1440, 1808:768, 2112:912, 1280:720, 720:1280, 
      720:720, 960:720, 720:960, 1680:720. Use 1920:1080 by default. It also accepts reference images, in the form of either a url or a base64 encoded image. 
      Each reference image has a tag, which is a string that refers to the image from the user prompt. For example, if the user prompt is "IMG_1 on a red background", 
      and the reference image has the tag "IMG_1", the model will use that reference image to generate the image. The return of this function will contain a url to the generated image.`,
      {
        promptText: z.string(),
        ratio: z.string(),
        referenceImages: z
          .array(z.object({ uri: z.string(), tag: z.string().optional() }))
          .optional(),
      },
      async ({ promptText, ratio, referenceImages }) => {
        const task = await callRunwayAsync("/text_to_image", {
          method: "POST",
          body: JSON.stringify({
            model: "gen4_image",
            promptText,
            ratio,
            referenceImages,
          }),
        });
    
        if (task.status === "SUCCEEDED") {
          return {
            content: [
              {
                type: "text",
                text: `Here is the URL of the image: ${task.output[0]}. Return to the user, as a markdown link, the URL of the image and the prompt that was used to generate the image.`,
              },
            ],
          };
        } else {
          return { content: [{ type: "text", text: JSON.stringify(task) }] };
        }
      }
    );
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses key behavioral traits: the tool generates images, accepts reference images with tags, and returns a URL. However, it misses details like rate limits, authentication needs, or error handling. It does not contradict annotations (none provided).

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 appropriately sized and front-loaded, starting with the core purpose. Every sentence adds value (e.g., ratio options, reference image mechanics, return format). It could be slightly more structured but avoids redundancy and is efficient.

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

Completeness3/5

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

Given no annotations, no output schema, and 0% schema coverage, the description does well by explaining parameters and return values. However, for a generative tool with siblings, it lacks details on limitations (e.g., prompt length, image size) and error cases, leaving some gaps in completeness.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must compensate. It adds significant meaning: it explains 'ratio' with available values and a default, and details 'referenceImages' with tags and usage examples. It covers all 3 parameters (promptText, ratio, referenceImages) beyond the schema, though not exhaustively for each.

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

Purpose5/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 an image from a text prompt and optional reference images.' It specifies the verb ('generate'), resource ('image'), and distinguishes from siblings like runway_generateVideo (image vs. video generation) and runway_editVideo (generation vs. editing).

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

Usage Guidelines3/5

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

The description implies usage through examples (e.g., 'if the user prompt is "IMG_1 on a red background"') but does not explicitly state when to use this tool versus alternatives like runway_generateVideo or runway_upscaleVideo. It provides context for reference images but lacks clear when/when-not guidance.

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/runwayml/runway-api-mcp-server'

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