Skip to main content
Glama

生成图片

generate_image

Create or edit images from text prompts and reference images, choose from several generation models, and get saved originals plus inline previews and metadata.

Instructions

文生图 / 图生图 / 改图的一站式工具:默认保存完整原图,同时返回有大小上限的 MCP 图片预览、结构化元数据和 JSON 文本兜底。大图(4K)会自动走异步任务并在内部等待完成,无需手动轮询。支持 Gemini 系列、GPT-Image-2 / 2.5、Wan2.7、Seedream 5.0 Pro,模型由 model 参数选择,无需指定提供商。

Input Schema

NameRequiredDescriptionDefault
modelNo图片生成模型,默认 gemini-3-pro-image。选择建议:gemini-3-pro-image 综合最强、指令遵循和文字渲染好(15 积分/1K-2K);gemini-3.1-flash-image 快速便宜的日常生成(10 积分);gpt-image-2 性价比最高(4 积分起);gpt-image-2.5-flare 偏快速出图,gpt-image-2.5-sunburst 偏细节密集;两者同价,具体尺寸和积分先用 estimate_credits 查询;wan2.7-image-pro / wan2.7-image 写实与海报风格;seedream-5-0-pro 擅长精准局部编辑(配合参考图使用)
promptYes
saveDirNohybrid/file 模式下的保存目录,默认取 LABNANA_OUTPUT_DIR 或当前目录下的 labnana-images/
outputModeNo结果返回方式:hybrid(默认)保存原图并内联有界预览,跨客户端兼容性最好;file 只保存原图并返回定位信息;inline 不保存到 saveDir,有 URL 时返回有界预览,无 URL 时把原图保存到默认恢复目录并返回有界预览
imageConfigNo
timeoutSecondsNo生成总超时秒数,默认 300(仅 4K 等异步路径需要等待时生效)
referenceImagesNo图生图 / 改图的参考图片,支持 fileUri(gs:// 或 https://)或 base64 inlineData

Output Schema

NameRequiredDescriptionDefault
errorNo
imagesYes
statusYes
taskIdNo
messageNo
warningsNo
retryableNo
generationNo
schemaVersionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed11 schema fields changedv2.2.0
    • addedInput schema / $schema
      Added value: +"http://json-schema.org/draft-07/schema#"
    • addedInput schema / additionalProperties
      Added value: +false
    • addedInput schema / properties / imageConfig
      Added value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "aspectRatio": {
      +      "enum": [
      +        "1:1",
      +        "2:3",
      +        "3:2",
      +        "3:4",
      +        "4:3",
      +        "4:5",
      +        "5:4",
      +        "9:16",
      +        "16:9",
      +        "21:9",
      +        "1:4",
      +        "4:1",
      +        "1:8",
      +        "8:1"
      +      ],
      +      "type": "string"
      +    },
      +    "imageSize": {
      +      "enum": [
      +        "1K",
      +        "2K",
      +        "4K"
      +      ],
      +      "type": "string"
      +    },
      +    "quality": {
      +      "type": "string"
      +    }
      +  },
      +  "type": "object"
      +}
    • addedInput schema / properties / model
      Added value: +{
      +  "description": "图片生成模型,默认 gemini-3-pro-image。选择建议:gemini-3-pro-image 综合最强、指令遵循和文字渲染好(15 积分/1K-2K);gemini-3.1-flash-image 快速便宜的日常生成(10 积分);gpt-image-2 性价比最高(4 积分起);gpt-image-2.5-flare 偏快速出图,gpt-image-2.5-sunburst 偏细节密集;两者同价,具体尺寸和积分先用 estimate_credits 查询;wan2.7-image-pro / wan2.7-image 写实与海报风格;seedream-5-0-pro 擅长精准局部编辑(配合参考图使用)",
      +  "enum": [
      +    "gemini-3-pro-image",
      +    "gemini-3.1-flash-image",
      +    "gpt-image-2",
      +    "gpt-image-2.5-flare",
      +    "gpt-image-2.5-sunburst",
      +    "wan2.7-image-pro",
      +    "wan2.7-image",
      +    "seedream-5-0-pro"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / outputMode
      Added value: +{
      +  "description": "结果返回方式:hybrid(默认)保存原图并内联有界预览,跨客户端兼容性最好;file 只保存原图并返回定位信息;inline 不保存到 saveDir,有 URL 时返回有界预览,无 URL 时把原图保存到默认恢复目录并返回有界预览",
      +  "enum": [
      +    "hybrid",
      +    "file",
      +    "inline"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / prompt
      Added value: +{
      +  "minLength": 1,
      +  "type": "string"
      +}
    • addedInput schema / properties / referenceImages
      Added value: +{
      +  "description": "图生图 / 改图的参考图片,支持 fileUri(gs:// 或 https://)或 base64 inlineData",
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "fileData": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "fileUri": {
      +            "minLength": 1,
      +            "type": "string"
      +          },
      +          "mimeType": {
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "fileUri"
      +        ],
      +        "type": "object"
      +      },
      +      "inlineData": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "data": {
      +            "minLength": 1,
      +            "type": "string"
      +          },
      +          "mimeType": {
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "data"
      +        ],
      +        "type": "object"
      +      }
      +    },
      +    "type": "object"
      +  },
      +  "maxItems": 14,
      +  "type": "array"
      +}
    • addedInput schema / properties / saveDir
      Added value: +{
      +  "description": "hybrid/file 模式下的保存目录,默认取 LABNANA_OUTPUT_DIR 或当前目录下的 labnana-images/",
      +  "minLength": 1,
      +  "type": "string"
      +}
    • addedInput schema / properties / timeoutSeconds
      Added value: +{
      +  "description": "生成总超时秒数,默认 300(仅 4K 等异步路径需要等待时生效)",
      +  "maximum": 3600,
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • addedInput schema / required
      Added value: +[
      +  "prompt"
      +]
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": false,
      +  "properties": {
      +    "error": {
      +      "additionalProperties": false,
      +      "properties": {
      +        "details": {},
      +        "message": {
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "message"
      +      ],
      +      "type": "object"
      +    },
      +    "generation": {
      +      "additionalProperties": false,
      +      "properties": {
      +        "finishReason": {
      +          "type": "string"
      +        },
      +        "modelVersion": {
      +          "type": "string"
      +        },
      +        "responseId": {
      +          "type": "string"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "images": {
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "byteLength": {
      +            "minimum": 0,
      +            "type": "integer"
      +          },
      +          "filePath": {
      +            "minLength": 1,
      +            "type": "string"
      +          },
      +          "height": {
      +            "exclusiveMinimum": 0,
      +            "type": "integer"
      +          },
      +          "index": {
      +            "minimum": 0,
      +            "type": "integer"
      +          },
      +          "mimeType": {
      +            "type": "string"
      +          },
      +          "preview": {
      +            "additionalProperties": false,
      +            "properties": {
      +              "byteLength": {
      +                "minimum": 0,
      +                "type": "integer"
      +              },
      +              "height": {
      +                "exclusiveMinimum": 0,
      +                "type": "integer"
      +              },
      +              "included": {
      +                "type": "boolean"
      +              },
      +              "mimeType": {
      +                "type": "string"
      +              },
      +              "width": {
      +                "exclusiveMinimum": 0,
      +                "type": "integer"
      +              }
      +            },
      +            "required": [
      +              "included"
      +            ],
      +            "type": "object"
      +          },
      +          "sha256": {
      +            "pattern": "^[a-f0-9]{64}$",
      +            "type": "string"
      +          },
      +          "url": {
      +            "format": "uri",
      +            "type": "string"
      +          },
      +          "width": {
      +            "exclusiveMinimum": 0,
      +            "type": "integer"
      +          }
      +        },
      +        "required": [
      +          "index",
      +          "mimeType",
      +          "preview"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "message": {
      +      "type": "string"
      +    },
      +    "retryable": {
      +      "type": "boolean"
      +    },
      +    "schemaVersion": {
      +      "const": 1,
      +      "type": "number"
      +    },
      +    "status": {
      +      "enum": [
      +        "succeeded",
      +        "pending",
      +        "failed"
      +      ],
      +      "type": "string"
      +    },
      +    "taskId": {
      +      "type": "string"
      +    },
      +    "warnings": {
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "required": [
      +    "schemaVersion",
      +    "status",
      +    "images"
      +  ],
      +  "type": "object"
      +}
  2. First observedv1.0.0

TDQS

A3.7/5.0
Behavior4/5

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

With no annotations present, the description carries the full burden and does substantial work: it discloses the default disk side effect (saving full-resolution originals), the bounded preview returned to MCP, structured metadata plus a JSON text fallback, automatic async handling for 4K, and that providers never need to be specified. It does not mention auth requirements, credit costs, or whether files are overwritten on repeat calls.

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?

Two dense sentences, front-loaded with the tool's scope before moving to output behavior and model selection; nothing is redundant. Density works against it slightly — file handling, preview format, async behavior, and model selection are all packed without visual separation, making it easy to skim past the async-wait detail.

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

Completeness4/5

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

Given seven parameters, nested reference-image objects, enums, and an output schema, the description covers the pieces an agent most needs: what gets saved where, what comes back, and that long-running 4K calls resolve internally. The main omission is any mention of credit consumption or a pointer to estimate_credits, which matters for a paid generation tool.

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

Parameters3/5

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

Schema coverage is 71% and the schema itself is unusually rich — per-model cost and use-case guidance, outputMode semantics, saveDir defaults, and referenceImages formats are all documented inline. The description adds only that models are chosen via the model parameter and no provider field is needed, which is marginal value over the schema and leaves prompt, imageConfig, and timeoutSeconds untouched at the description level.

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

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a precise scope — text-to-image, image-to-image, and image editing in one tool — so the agent knows exactly which operation family this covers. It implicitly differentiates from the task-polling siblings by stating 'no manual polling needed', but never names get_generation_task or list_generation_tasks, so sibling routing is only inferable.

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?

Usage context is implied through the three modes (text-to-image / image-to-image / editing) and the note that 4K runs async internally without polling, which steers the agent away from a poll loop. However, there is no explicit statement of when NOT to call this tool, no pointer to estimate_credits before spending credits, and no reference to the task-listing siblings as an alternative view.

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