Skip to main content
Glama

Generate AI media (image or animation)

generate_media

Generate an AI image or a canvas-code-based animation directly into a clip.

  • kind="image": text-to-image. Pass prompt. Optional: animation_setting (entry/exit — set it HERE, see below), style_id (from find type='image_gen_style_packs'), reference_image_url or mcp_upload_id for image-to-image grounding.

  • kind="animation": canvas-code animation rendered from a prompt. Pass prompt. Optional: voiceover_text (drives timing), base_component_id (reuse a saved animation as the starting point), reference_image_url or mcp_upload_id for visual grounding.

Generation is asynchronous: the element is created immediately with a stable element_id and rendered in the background. Poll get_clip(select:['busy']): an EMPTY busy means the render has landed. (This previously said to watch the phantom flag; phantom has never been a key get_clip returns, so there was nothing to poll.)

Set presentation up front. animation_setting is applied to the element as it is created, so the image enters correctly the first time it renders. Doing it afterwards with update_elements means writing to the element that is still generating, which is the write most likely to be refused while the generation holds it.

group is NOT accepted here, unlike add_elements: a generated element is built in the background, and the grouping would be overwritten when the render lands. Add it ungrouped, then call update_elements with group once it appears.

TIMING: images land in seconds; animations take tens of seconds to a few minutes. Poll get_clip(select:['busy']) until busy is empty. A slow animation is still rendering, not stuck: do not call generate_media again for it, because each call is a new generation and uses credits again.

Tip: use this tool whenever the user asks for a "generated", "AI", or "create me a" visual. For uploaded photos / logos / icons / GIFs, use add_elements with element_type='image' and a src or mcp_upload_id instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xYesTop-left X in canvas pixels.
yYesTop-left Y in canvas pixels.
kindYes'image' = AI text-to-image; 'animation' = canvas-code-based motion graphic.
modelNoImage only. Which image model renders it. Default `gemini-3-pro-image` (Nano Banana Pro), a strong general choice — leave it off unless you want one of the specifics below. `gemini-3.1-flash-image` (Nano Banana 2), `gemini-nano-banana-2.1` (Nano Banana 2.1, Google's newest), `gemini-3.1-flash-lite-image` (Nano Banana 2 Lite, the fastest and cheapest) and `gemini-2.5-flash-image` are faster and cheaper. `gpt-image-2.5-flare` is OpenAI's fast one, `gpt-image-2.5-sunburst` its most precise editor, and `gpt-image-2` is the one to reach for when the image must carry legible text or follow several reference images. `gpt-image-1` / `gpt-image-1.5` are the older pair and only accept square-ish framing — a wide box is snapped to 4:3 rather than honoured, so do not pick them for a banner. An unlisted value is rejected here rather than silently swapped for the default, which is what the backend does with one.
widthYesWidth in pixels.
heightYesHeight in pixels.
promptYesGeneration prompt. For animations, be SPECIFIC: name the UI elements, interaction sequence, timing feel, and visual style. Vague prompts produce bad output.
clip_idYesClip ID to place the generated element into.
end_timeNoDisappear at (seconds).
style_idNoImage only. Style preset ID from find(type='image_gen_style_packs'). See resource clueso://docs/generation-styles.
backgroundNoImage only, and only honoured by `gpt-image-2.5-flare`, `gpt-image-2.5-sunburst`, `gpt-image-1` and `gpt-image-1.5` — every other model is always opaque and ignores this. Pass `false` for a cut-out with no background: icons, logos, stickers, anything meant to sit ON the composition rather than behind it. You MUST set `model` to one of those four in the same call; `gpt-image-2.5-flare` is the one to default to, since the older pair cannot frame wide. Asking for transparency in the PROMPT instead does not work — the model paints a grey-and-white checkerboard as real pixels.
project_idYesProject ID.
start_timeNoAppear at (seconds).
aspect_ratioNoImage only. Overrides the ratio inferred from width/height. Leave it off and the box decides, which is usually what you want — set it when the box is a placeholder and you know the shape you need. Still clamped to what the model accepts: gpt-image-1/1.5 only do 1:1, 4:3 and 3:4; the gpt-image-2.5 pair adds 16:9 and 9:16; gpt-image-2 has no 3:2 or 2:3, so those become 4:3 and 3:4. The response does not report the ratio used.
mcp_upload_idNomcp_upload_id from the upload flow. Resolved server-side to a presigned URL before generation.
voiceover_textNoAnimation only. Paces the motion to the spoken script — and as a side effect sets this clip's voiceover text and triggers speech generation for the clip. If the clip's current voiceover_text (get_clip) has <SYNC_MARKER N> tokens, this text must carry each of them once, in order, or the animation is refused.
animation_settingNoImage only. Entry/exit animation, same shape as add_elements' type_data.animation_setting. The design guide asks AI images to enter with `masked_reveal` or a slow fade, so set it here rather than following up with update_elements — that follow-up targets the element while it is still generating. Ignored for kind='animation', which animates through its generated code.
base_component_idNoAnimation only. Reuse a saved animation component as the starting point (from find(type='element_components')). To re-skin its tunable parameters, set parameter_values via update_elements after it renders.
reference_image_urlNoPublic URL of a reference image. Mutually exclusive with mcp_upload_id.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / model / description
      Previous value: -"Image only. Which image model renders it. Default `gemini-3-pro-image-preview` (Nano Banana Pro), a strong general choice — leave it off unless you want one of the specifics below. `gemini-3.1-flash-image-preview` (Nano Banana 2) and `gemini-2.5-flash-image` are faster and cheaper. `gpt-image-2.5-flare` is OpenAI's fast one, `gpt-image-2.5-sunburst` its most precise editor, and `gpt-image-2` is the one to reach for when the image must carry legible text or follow several reference images. `gpt-image-1` / `gpt-image-1.5` are the older pair and only accept square-ish framing — a wide box is snapped to 4:3 rather than honoured, so do not pick them for a banner. An unlisted value is rejected here rather than silently swapped for the default, which is what the backend does with one."New value: +"Image only. Which image model renders it. Default `gemini-3-pro-image` (Nano Banana Pro), a strong general choice — leave it off unless you want one of the specifics below. `gemini-3.1-flash-image` (Nano Banana 2), `gemini-nano-banana-2.1` (Nano Banana 2.1, Google's newest), `gemini-3.1-flash-lite-image` (Nano Banana 2 Lite, the fastest and cheapest) and `gemini-2.5-flash-image` are faster and cheaper. `gpt-image-2.5-flare` is OpenAI's fast one, `gpt-image-2.5-sunburst` its most precise editor, and `gpt-image-2` is the one to reach for when the image must carry legible text or follow several reference images. `gpt-image-1` / `gpt-image-1.5` are the older pair and only accept square-ish framing — a wide box is snapped to 4:3 rather than honoured, so do not pick them for a banner. An unlisted value is rejected here rather than silently swapped for the default, which is what the backend does with one."
    • changedInput schema / properties / model / enum
      Previous value: -[
      -  "gemini-3-pro-image-preview",
      -  "gemini-3.1-flash-image-preview",
      -  "gemini-2.5-flash-image",
      -  "gpt-image-2.5-flare",
      -  "gpt-image-2.5-sunburst",
      -  "gpt-image-2",
      -  "gpt-image-1.5",
      -  "gpt-image-1"
      -]New value: +[
      +  "gemini-3-pro-image",
      +  "gemini-3.1-flash-image",
      +  "gemini-nano-banana-2.1",
      +  "gemini-3.1-flash-lite-image",
      +  "gemini-2.5-flash-image",
      +  "gpt-image-2.5-flare",
      +  "gpt-image-2.5-sunburst",
      +  "gpt-image-2",
      +  "gpt-image-1.5",
      +  "gpt-image-1"
      +]
  2. Changed1 schema field changed
    • changedInput schema / properties / voiceover_text / description
      Previous value: -"Animation only. Paces the motion to the spoken script — and as a side effect sets this clip's voiceover text and triggers speech generation for the clip."New value: +"Animation only. Paces the motion to the spoken script — and as a side effect sets this clip's voiceover text and triggers speech generation for the clip. If the clip's current voiceover_text (get_clip) has <SYNC_MARKER N> tokens, this text must carry each of them once, in order, or the animation is refused."
  3. Changed7 schema fields changed
    • addedInput schema / additionalProperties
      Added value: +{}
    • removedInput schema / properties / animation_setting / properties / entry / properties / duration_per_unit_ms / exclusiveMinimum
      Removed value: -0
    • addedInput schema / properties / animation_setting / properties / entry / properties / duration_per_unit_ms / minimum
      Added value: +0
    • removedInput schema / properties / animation_setting / properties / exit / properties / duration_per_unit_ms / exclusiveMinimum
      Removed value: -0
    • addedInput schema / properties / animation_setting / properties / exit / properties / duration_per_unit_ms / minimum
      Added value: +0
    • addedInput schema / properties / aspect_ratio
      Added value: +{
      +  "description": "Image only. Overrides the ratio inferred from width/height. Leave it off and the box decides, which is usually what you want — set it when the box is a placeholder and you know the shape you need. Still clamped to what the model accepts: gpt-image-1/1.5 only do 1:1, 4:3 and 3:4; the gpt-image-2.5 pair adds 16:9 and 9:16; gpt-image-2 has no 3:2 or 2:3, so those become 4:3 and 3:4. The response does not report the ratio used.",
      +  "enum": [
      +    "1:1",
      +    "4:3",
      +    "3:4",
      +    "16:9",
      +    "9:16",
      +    "3:2",
      +    "2:3"
      +  ],
      +  "type": "string"
      +}
    • changedInput schema / properties / background / description
      Previous value: -"Image only, and only honoured by `gpt-image-2.5-flare`, `gpt-image-2.5-sunburst`, `gpt-image-1` and `gpt-image-1.5` — every other model is always opaque and ignores this. Pass `false` for a cut-out with no background: icons, logos, stickers, anything meant to sit ON the composition rather than behind it. You MUST set `model` to one of those four in the same call; `gpt-image-2.5-flare` is the one to default to, since the older pair cannot frame wide."New value: +"Image only, and only honoured by `gpt-image-2.5-flare`, `gpt-image-2.5-sunburst`, `gpt-image-1` and `gpt-image-1.5` — every other model is always opaque and ignores this. Pass `false` for a cut-out with no background: icons, logos, stickers, anything meant to sit ON the composition rather than behind it. You MUST set `model` to one of those four in the same call; `gpt-image-2.5-flare` is the one to default to, since the older pair cannot frame wide. Asking for transparency in the PROMPT instead does not work — the model paints a grey-and-white checkerboard as real pixels."
  4. Changed4 schema fields changed
    • removedInput schema / properties / context
      Removed value: -{
      -  "description": "Explain in 15-25 words, in third person, why this tool is called and how it supports the user's goal. For analytics only. You MUST describe only the abstract purpose of the tool call. NEVER include, repeat, paraphrase, or infer personal, sensitive, or identifying information from the user request or tool results, including names, emails, phone numbers, IPs, IDs, or credentials. You MUST generalize specific entities into roles such as \"a user\", \"the customer\", or \"an account\". Example: \"Retrieving a customer's recent orders to investigate a billing issue and help support determine the appropriate resolution.\"",
      -  "type": "string"
      -}
    • removedInput schema / properties / conversation_id
      Removed value: -{
      -  "description": "Echo the conversation_id from the server's previous response. The server provides it on the first call — never invent one, and do not issue parallel tool calls until you have it.",
      -  "type": "string"
      -}
    • removedInput schema / properties / llm_model
      Removed value: -{
      -  "description": "The exact model identifier you (the assistant) are running as, taken from your system prompt or environment (e.g. \"claude-opus-4-8\", \"gpt-5.2\"). Used for analytics only. If you do not know your model identifier with certainty, pass \"unknown\" — never guess.",
      -  "type": "string"
      -}
    • changedInput schema / required
      Previous value: -[
      -  "kind",
      -  "project_id",
      -  "clip_id",
      -  "prompt",
      -  "x",
      -  "y",
      -  "width",
      -  "height",
      -  "context",
      -  "llm_model"
      -]New value: +[
      +  "kind",
      +  "project_id",
      +  "clip_id",
      +  "prompt",
      +  "x",
      +  "y",
      +  "width",
      +  "height"
      +]
  5. Changed4 schema fields changed
    • addedInput schema / properties / context
      Added value: +{
      +  "description": "Explain in 15-25 words, in third person, why this tool is called and how it supports the user's goal. For analytics only. You MUST describe only the abstract purpose of the tool call. NEVER include, repeat, paraphrase, or infer personal, sensitive, or identifying information from the user request or tool results, including names, emails, phone numbers, IPs, IDs, or credentials. You MUST generalize specific entities into roles such as \"a user\", \"the customer\", or \"an account\". Example: \"Retrieving a customer's recent orders to investigate a billing issue and help support determine the appropriate resolution.\"",
      +  "type": "string"
      +}
    • addedInput schema / properties / conversation_id
      Added value: +{
      +  "description": "Echo the conversation_id from the server's previous response. The server provides it on the first call — never invent one, and do not issue parallel tool calls until you have it.",
      +  "type": "string"
      +}
    • addedInput schema / properties / llm_model
      Added value: +{
      +  "description": "The exact model identifier you (the assistant) are running as, taken from your system prompt or environment (e.g. \"claude-opus-4-8\", \"gpt-5.2\"). Used for analytics only. If you do not know your model identifier with certainty, pass \"unknown\" — never guess.",
      +  "type": "string"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "kind",
      -  "project_id",
      -  "clip_id",
      -  "prompt",
      -  "x",
      -  "y",
      -  "width",
      -  "height"
      -]New value: +[
      +  "kind",
      +  "project_id",
      +  "clip_id",
      +  "prompt",
      +  "x",
      +  "y",
      +  "width",
      +  "height",
      +  "context",
      +  "llm_model"
      +]
  6. Changed5 schema fields changed
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / animation_setting
      Added value: +{
      +  "description": "Image only. Entry/exit animation, same shape as add_elements' type_data.animation_setting. The design guide asks AI images to enter with `masked_reveal` or a slow fade, so set it here rather than following up with update_elements — that follow-up targets the element while it is still generating. Ignored for kind='animation', which animates through its generated code.",
      +  "properties": {
      +    "entry": {
      +      "description": "Entry (appear) animation phase.",
      +      "properties": {
      +        "apply_to_unit": {
      +          "description": "Granularity. 'typewriter' is restricted to 'char'.",
      +          "enum": [
      +            "char",
      +            "word",
      +            "line",
      +            "box"
      +          ],
      +          "type": "string"
      +        },
      +        "direction": {
      +          "description": "Slide direction for this phase. Ignored by fade/scale/pop/typewriter; pass 'none' when the preset has no direction.",
      +          "enum": [
      +            "left",
      +            "right",
      +            "top",
      +            "bottom",
      +            "center_all",
      +            "center_vertically",
      +            "center_horizontally",
      +            "none"
      +          ],
      +          "type": "string"
      +        },
      +        "duration_per_unit_ms": {
      +          "description": "NAME IS MISLEADING — this is the TOTAL duration of the phase in ms (NOT per unit). The renderer splits it across all N units with ~50% overlap. For a perceptible per-unit rhythm scale UP with the unit count (e.g. typewriter on N chars ≈ N × 100–200 ms). For applyToUnit='box' it's just the phase duration. Omit it and you get 400ms, the same default the editor creates with.",
      +          "exclusiveMinimum": 0,
      +          "type": "number"
      +        },
      +        "preset": {
      +          "description": "Preset for this phase. 'typewriter' is char-only and has no direction.",
      +          "enum": [
      +            "slide",
      +            "fade",
      +            "pop",
      +            "scale",
      +            "masked_reveal",
      +            "typewriter",
      +            "none"
      +          ],
      +          "type": "string"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "exit": {
      +      "description": "Exit (disappear) animation phase.",
      +      "properties": {
      +        "apply_to_unit": {
      +          "description": "Granularity. 'typewriter' is restricted to 'char'.",
      +          "enum": [
      +            "char",
      +            "word",
      +            "line",
      +            "box"
      +          ],
      +          "type": "string"
      +        },
      +        "direction": {
      +          "description": "Slide direction for this phase. Ignored by fade/scale/pop/typewriter; pass 'none' when the preset has no direction.",
      +          "enum": [
      +            "left",
      +            "right",
      +            "top",
      +            "bottom",
      +            "center_all",
      +            "center_vertically",
      +            "center_horizontally",
      +            "none"
      +          ],
      +          "type": "string"
      +        },
      +        "duration_per_unit_ms": {
      +          "description": "NAME IS MISLEADING — this is the TOTAL duration of the phase in ms (NOT per unit). The renderer splits it across all N units with ~50% overlap. For a perceptible per-unit rhythm scale UP with the unit count (e.g. typewriter on N chars ≈ N × 100–200 ms). For applyToUnit='box' it's just the phase duration. Omit it and you get 400ms, the same default the editor creates with.",
      +          "exclusiveMinimum": 0,
      +          "type": "number"
      +        },
      +        "preset": {
      +          "description": "Preset for this phase. 'typewriter' is char-only and has no direction.",
      +          "enum": [
      +            "slide",
      +            "fade",
      +            "pop",
      +            "scale",
      +            "masked_reveal",
      +            "typewriter",
      +            "none"
      +          ],
      +          "type": "string"
      +        }
      +      },
      +      "type": "object"
      +    }
      +  },
      +  "type": "object"
      +}
    • addedInput schema / properties / background
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "boolean"
      +    },
      +    {
      +      "enum": [
      +        "0",
      +        "1",
      +        "true",
      +        "false",
      +        "yes",
      +        "no"
      +      ],
      +      "type": "string"
      +    }
      +  ],
      +  "description": "Image only, and only honoured by `gpt-image-2.5-flare`, `gpt-image-2.5-sunburst`, `gpt-image-1` and `gpt-image-1.5` — every other model is always opaque and ignores this. Pass `false` for a cut-out with no background: icons, logos, stickers, anything meant to sit ON the composition rather than behind it. You MUST set `model` to one of those four in the same call; `gpt-image-2.5-flare` is the one to default to, since the older pair cannot frame wide."
      +}
    • addedInput schema / properties / model
      Added value: +{
      +  "description": "Image only. Which image model renders it. Default `gemini-3-pro-image-preview` (Nano Banana Pro), a strong general choice — leave it off unless you want one of the specifics below. `gemini-3.1-flash-image-preview` (Nano Banana 2) and `gemini-2.5-flash-image` are faster and cheaper. `gpt-image-2.5-flare` is OpenAI's fast one, `gpt-image-2.5-sunburst` its most precise editor, and `gpt-image-2` is the one to reach for when the image must carry legible text or follow several reference images. `gpt-image-1` / `gpt-image-1.5` are the older pair and only accept square-ish framing — a wide box is snapped to 4:3 rather than honoured, so do not pick them for a banner. An unlisted value is rejected here rather than silently swapped for the default, which is what the backend does with one.",
      +  "enum": [
      +    "gemini-3-pro-image-preview",
      +    "gemini-3.1-flash-image-preview",
      +    "gemini-2.5-flash-image",
      +    "gpt-image-2.5-flare",
      +    "gpt-image-2.5-sunburst",
      +    "gpt-image-2",
      +    "gpt-image-1.5",
      +    "gpt-image-1"
      +  ],
      +  "type": "string"
      +}
  7. First observed

TDQS

A4.6/5.0
Behavior4/5

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

Annotations only declare the safety profile (readOnly/destructive/openWorld=false), and the description adds substantial behavior beyond that: asynchronous creation with a stable element_id, credit consumption per call, the correct polling signal (empty busy, with an explicit correction of the bogus phantom flag), why group is refused, and why animation_setting must be set up front to avoid refused writes on an in-flight element. It is rich, though it does not state auth/permission requirements.

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?

Front-loads the kind=image/kind=animation split and clearly segments timing, group, and tip guidance. Almost every sentence earns its place, but the parenthetical about the old phantom flag is historical housekeeping rather than actionable guidance and costs some tightness.

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

Completeness5/5

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

For a 19-parameter, nested-object, mutation tool with no output schema, the description covers the async lifecycle, polling, credit cost, timing expectations, param-ordering constraints, and sibling routing. An agent has everything needed to invoke it correctly and safely.

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 coverage is 100%, so the baseline is 3, but the description adds real meaning beyond the schema: it prescribes when to set animation_setting (at creation, not via update_elements), explains why group is not accepted here, and notes voiceover_text also triggers clip speech generation. These are operational semantics the schema text alone does not fully convey.

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?

Opens with a specific verb+resource ('Generate an AI image or a canvas-code-based animation directly into a clip') and then breaks the two modes into distinct bulleted sub-purposes with their required/optional params. It also explicitly contrasts itself with add_elements for uploaded media, so an agent can tell the two apart without opening either schema.

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

Usage Guidelines5/5

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

Gives explicit when-to-use ('whenever the user asks for a generated/AI/create-me visual'), when-not-to-use (uploads/logos/GIFs go to add_elements with a src/upload), and a strong 'do not call again' directive for slow animations. It also names where each optional param's value comes from (find, get_clip).

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources