Skip to main content
Glama

生成图片

generate_image
DestructiveIdempotent

Create images from text prompts with supported image models, optionally editing or fusing reference images. Returns a task_id for async result retrieval and estimated_cost_usd.

Instructions

用 Grok Imagine、Midjourney 或分组中其他按张计价的图片模型生成图片,会产生上游模型调用费用,返回 estimated_cost_usd。已适配型号可用 reference_images 编辑或融合图片,先查 list_media_models 的素材上限;部分 GPT Image 已接入多图。立即返回 task_id,用 get_task 取结果。Midjourney 按当前每次 4 张估价,实际扣费以使用记录为准;其他图片模型可选 1–4 张。只有用户明确要求创作时调用。

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "operation_id": "<operation_id>",
      "model": "<model>",
      "prompt": "<prompt>"
    },
    "name": "generate_image"
  }
}

Input Schema

NameRequiredDescriptionDefault
nNoGrok 默认 1 张;Midjourney 固定 4 张
imageNo视频首帧或单张编辑参考图:HTTPS、JPEG/PNG/WebP data URL 或本地图片路径
modelYes先从 list_media_models 选择可用模型
promptYes用户希望生成的内容
credentialNo密钥别名;多把密钥时必填,不能传密钥本身
image_fileNoChatGPT 聊天中附加的单张图片,作用同 image;其他客户端请用 create_upload_link
resolutionNo模型支持的清晰度;以 list_media_models 为准
aspect_ratioNo模型支持的比例;图片默认 1:1,视频默认 16:9
operation_idYes本次创作唯一标识,例如 UUID。重试同一请求须复用原值,防止重复提交;新的用户需求才用新值
reference_filesNoChatGPT 聊天中附加的多张参考图,按顺序追加在 reference_images 之后
reference_imagesNo有序参考图片列表;格式同 image,素材合计不超过 14 MB。Grok 图片最多 3 张,视频经典版 7/1.5 版 14 张;已适配 Seedance 2.0 最多 9/2.5 最多 14 张、Kling Omni 7 张、Midjourney 10 张、部分 GPT Image 14 张。准确型号与首帧组合限制以 list_media_models.inputs 为准

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0-rc.13

TDQS

A4.6/5.0
Behavior5/5

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

Annotations declare a destructive, open-world, idempotent write, and the description adds the concrete consequences: upstream model call costs, an estimated_cost_usd return, immediate task_id with async retrieval via get_task, and the operation_id reuse rule that makes retries safe. It also discloses the Midjourney 4-images-per-call pricing approximation and that actual billing follows usage records, which is exactly the kind of context annotations cannot carry.

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?

Purpose and cost/return behavior are front-loaded, and every clause carries operational information (limits, billing caveat, async flow). The middle section is dense and run-on, stacking several model-specific constraints into a single stream, which slightly hurts scanability.

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 an 11-parameter, nested-object tool with no output schema, the description covers what an agent needs: cost implications, the return shape (estimated_cost_usd and task_id), how to retrieve results, and where to resolve model-specific limits. Nothing essential to calling it correctly is left unexplained.

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 on top: per-model image counts for n (Grok default 1, Midjourney fixed 4), the role of reference_images for editing/blending, and that exact per-model limits live in list_media_models.inputs. It does not explain credential, resolution, or aspect_ratio beyond what the schema already states.

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 verb and resource (generate images) and names the concrete model families it routes to (Grok Imagine, Midjourney, other per-image priced models), which distinguishes it cleanly from the sibling generate_video. An agent can identify the tool's function without opening the schema.

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 gives a hard gating rule (only call when the user explicitly requests creation) and a prerequisite workflow (check list_media_models for material limits first), plus the follow-up step get_task. It does not explicitly contrast against generate_video for motion requests, so the alternative-selection guidance is implied rather than stated.

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