Skip to main content
Glama

generate

Submit a prompt to start an image or video generation, returning a record you can poll for results. Optionally provide a webhook callback URL to be notified when the generation finishes.

Instructions

Kick off a generation via POST /api/gens/.

Args:
    prompt: The full prompt string, including any ``--flag`` parameters.
        E.g. ``"a fox in autumn foliage --ar 16:9 --flagship"``.
        Flags go at the END of the prompt. The ones people need most:
        ``--1`` / ``--2`` / ``--3`` / ``--4`` = how many images (default 4;
        ``--1`` for a single image, cheapest), ``--ar 16:9`` = aspect ratio,
        ``--v <model>`` = model. Anything else: call ``get_parameter(name)``
        or ``search_parameters`` first — never guess a flag.
    callback_url: Optional HTTPS URL that will receive a webhook when the
        generation reaches done / failed. See
        https://maginary.ai/blog/webhooks-guide for signature verification.

Returns:
    On success, the created generation record. Key fields: ``uuid`` (use
    to poll), ``action_type``, ``processing_state``,
    ``expected_output_count``.

    On failure, an ``isError`` result instead (nothing is raised), with a
    JSON body whose ``error`` field is one of:

    - ``"auth"`` — no/invalid API key. Surface the message directly to
      the human.
    - ``"payment_required"`` — out of credits. The body carries
      ``billing_url`` and ``challenge``: either send the human to
      ``billing_url`` to top up, or pay programmatically via x402 —
      ``challenge`` is the standard x402 payment-required payload (USDC
      on Base); settle it and retry this call.
    - ``"failed"`` — anything else (invalid prompt, rate limit, backend
      or network error); see ``message``.

    x402 over MCP: a ``payment_required`` result also carries the x402
    fields at the top level (``accepts``, ``resource``); an x402-capable
    client signs ``accepts[0]`` and calls this tool again with the payment
    in ``_meta["x402/payment"]``. The settled call returns the generation
    with ``x402_receipt`` (and ``_meta["x402/payment-response"]``); a
    wallet's first settlement also returns ``x402_account`` with an API
    key — pass it as ``_meta["maginary/api_key"]`` on later calls (or as
    the Authorization header of a new connection).

Every flag that exists, and its state: Flags, live (35): --ar, --output-count (--1/--2/--3/--4), --seed, --transparent, --sref, --sw, --png, --jpg, --webp, --svg, --2k, --4k, --upscale, --vary, --varysubtle, --varystrong, --panleft, --panright, --panup, --pandown, --zoomout, --mp4, --video-resolution (--480p/--540p/--720p/--1024p/--1080p/--2160p / --4k (4k, Seedance 2 Pro)/--480p24 / --480p24fps/--540p24 / --540p24fps/--720p24 / --720p24fps/--1024p30 / --1024p30fps/--1080p24 / --1080p24fps), --video-fps (--24fps/--30fps/--50fps/--60fps), --video-duration (--4s / --4sec/--5s / --5sec/--6s / --6sec/--8s / --8sec/--10s / --10sec/--12s / --12sec), --flagship, --sora, --soralite, --nanobananapro, --nb2, --gpt2, --gpt2high, --seedance2, --seedance2pro, --demo. Partial (4, only some models honour them): --no, --zoomout2x, --zoomoutexpand, --zoomoutexpand2x. Reserved (2, the parser rejects them): --cref, --cw. Any other --flag is rejected with Unrecognized parameter. Details: get_parameter(name).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYes
callback_urlNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv0.3.0

TDQS

A4.6/5.0
Behavior5/5

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

With no annotations, the description fully carries the behavioral burden and does so thoroughly: it discloses async completion (uuid to poll), no-exception error style (isError result, nothing raised), auth/payment failure modes, webhook signing, and the x402 settlement flow. No behavioral surprises are hidden.

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

Conciseness3/5

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

The content is front-loaded and labeled clearly (Args/Returns/errors/x402), but the description is extremely long, largely due to an exhaustive 35-flag enumeration that partly duplicates the get_parameter/search_parameters tools. It earns its detail for safety, but is not appropriately sized and could be tightened by delegating the full list.

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 mutable, two-parameter generation tool with no annotations, the description provides a complete operating manual: return fields, all error branches, billing and payment handling, x402 integration, flag constraints, and callback behavior. Nothing needed to invoke it correctly is missing.

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

Parameters5/5

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

Schema coverage is 0%, and the description compensates completely: prompt format, flag placement, examples, common flags, and the lookup rule for unknown flags are all covered; callback_url gets a definition, HTTPS requirement, and webhook documentation link. Every parameter acquires meaning beyond its bare schema type.

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 opens with a specific action and resource ('Kick off a generation via POST /api/gens/') and makes clear this creates a generation rather than inspecting one. The return contract (uuid for polling) further distinguishes it from sibling tools like get_generation and wait_for_generation.

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

Usage Guidelines4/5

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

It provides strong usage context: prompts carry flags, flags go at the end, unknown flags must be looked up via get_parameter/search_parameters first, and callback_url is optional for webhook notifications. It stops short of explicitly naming when-not-to-use alternatives, such as 'use get_generation or wait_for_generation instead of calling generate again to check status,' so it doesn't reach a 5.

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

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/maginaryai/maginary-mcp'

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