Skip to main content
Glama

maginary-mcp

Generate image or video

generate

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

Args:
    prompt: The user's words, passed through as-is. Do NOT add flags the
        user did not ask for — no ``--ar``, no ``--flagship``, no model
        flags. Every extra flag costs credits; adding them unrequested is
        wrong. Standard quality is the default and is cheap; ``--flagship``
        is ~4× more expensive and must only be used when the user
        explicitly asks for best quality.

        If the user asks about quality or aspect ratio: ask them first
        (standard vs flagship, landscape vs portrait) before generating.

        Flags go at the END, only when the user asked:
        ``--1``/``--2``/``--3``/``--4`` = image count (default 4),
        ``--ar 16:9`` = aspect ratio, ``--flagship`` = best quality.
        Unknown flag: call ``get_parameter(name)`` first — never guess.

        Examples — user says "a fox": prompt is ``"a fox"``.
        User says "a fox, landscape, best quality":
        prompt is ``"a fox --ar 16:9 --flagship"``.

        **Image-to-image (img2img):** Place one or more public image URLs
        in the prompt, followed by editing instructions:
        ``"https://cdn.example.com/photo.webp reimagine as oil painting --ar 16:9"``
        The engine extracts URLs automatically and switches to img2img mode.
        Multiple URLs trigger multi-input mode (compositing/combining).
        Use ``upload_image`` first if images aren't already hosted.

        **Image-to-video:** Place an image URL in the prompt AND add
        ``--mp4`` plus video flags (``--5sec``, ``--1080p``). Or use
        ``execute_action`` with ``action_type="img2vid_basic"`` on a
        completed generation's image.

        **Style reference (--sref) is NOT img2img:** ``--sref <url>``
        copies the visual *style* of a reference image (colors, mood,
        composition) without using the image content as input. A bare URL
        in the prompt edits the actual image; ``--sref`` transfers style.

    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 top-level x402 fields (``accepts``,
      ``resource``): either send the human to ``billing_url`` to top up,
      or pay programmatically via x402 (settle ``accepts[0]`` with USDC
      on Base and retry).
    - ``"demo_not_found"`` — ``--demo`` prompt has no matching seeded
      generation. ``available_demos`` lists valid prompts.
    - ``"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 creates its account. Subsequent requests
    use wallet-signed auth headers (X-Wallet-Address/Signature/Timestamp)
    or pass an API key as ``_meta["maginary/api_key"]``.

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
promptYesThe user's words as-is, flags at the end. Do NOT add flags the user did not ask for.
callback_urlNoHTTPS webhook URL for done/failed notifications.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.9/5.0
Behavior5/5

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

Beyond annotations (readOnlyHint=false, openWorldHint=true, etc.), the description discloses the POST endpoint, the credit cost of extra flags, the fact that errors are returned as isError instead of raised, and detailed error codes (auth, payment_required, demo_not_found, failed). It also explains x402 payment handling and non-idempotency, exceeding annotation coverage.

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 long but structured with clear sections and front-loaded with the main instruction. However, the exhaustive flag list at the end could be condensed by referencing get_parameter, making it slightly verbose though justified by the tool's complexity.

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?

Given the tool's complexity and rich output schema, the description covers return fields (uuid, action_type, etc.), error handling, payment flow, and integration with sibling tools. Nothing an agent needs to call 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?

While the schema already describes both parameters at 100% coverage, the description adds extensive semantics: how to format the prompt with flags at the end, img2img examples, style reference distinction, and callback_url usage. It even provides concrete prompt examples, greatly enriching meaning beyond the schema.

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 action ('Kick off a generation via POST /api/gens/') and the title confirms 'Generate image or video'. It distinguishes itself from siblings by explicitly instructing when to use upload_image, execute_action, and get_parameter, making the tool's purpose unambiguous.

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?

It provides explicit when-to-use guidance: tells the agent to ask the user about quality/aspect ratio before generating, to use upload_image first for unhosted images, to use execute_action for img2vid, and to use get_parameter for unknown flags. It also explains when not to add flags, with concrete examples.

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.