Skip to main content
Glama

生成图片

generate_image

Creates images from text prompts using the OpenAI Images API, with controls for model, size, quality, format, background, and inline or file output.

Instructions

通过 OpenAI Images API(/v1/images/generations)生成图片,支持 gpt-image-2 与 gpt-image-2.5 系列模型。

Input Schema

NameRequiredDescriptionDefault
nNo生成图片数量(1-10,默认 1)。
sizeNo图片尺寸:auto 或 宽x高;不同模型对尺寸的限制不同。auto
modelNo图像模型 ID,例如 gpt-image-2.5-flare;必须以 gpt-image- 开头。
inlineNo是否以 MCP image content 内联返回图片;设为 false 时必须提供 output_path。
promptYes图像生成或编辑的提示词(1-32000 个字符)。
qualityNo生成质量;xhigh 与 max 仅 gpt-image-2.5 系列支持。medium
overwriteNo是否允许覆盖已存在的文件。
backgroundNo背景模式;transparent 只能配合 png 或 webp。auto
moderationNo内容审核级别(默认 auto)。auto
output_pathNo保存路径:目录或以 / 结尾时按 image_1.ext 命名,文件路径且 n>1 时按 stem-1.ext 命名。
output_formatNo输出图片格式(默认 png)。png
output_compressionNo输出压缩率(0-100),仅 jpeg 与 webp 有效。

Output Schema

NameRequiredDescriptionDefault
sizeNo
modelYes
usageNo
imagesYes
qualityNo
warningNo
saved_pathsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

C2.9/5.0
Behavior2/5

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

Annotations already declare readOnlyHint=false, openWorldHint=true, idempotentHint=false, so the mutation/external-call profile is covered structurally. The description adds only the endpoint and model families; it says nothing about the fact that the call writes files to disk (output_path/overwrite), incurs cost and latency, or is subject to moderation, which are the traits an agent most needs beyond the annotations.

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?

A single front-loaded sentence with zero filler, identifying the mechanism and model scope immediately. It is efficient, though short enough that it does not use the freed space for any differentiation or behavioral context.

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

Completeness3/5

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

An output schema exists and the parameter schema is fully documented, so return values and inputs need no explanation. However, for a 12-parameter tool that persists files and has two close siblings, the description omits sibling routing and the file-writing behavior, leaving the definition only minimally complete.

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 description coverage is 100% across all 12 parameters, including enums and defaults, so the schema carries the parameter burden. The description adds no syntax, format, or constraint detail beyond what the schema already states (e.g., the gpt-image- prefix rule is already in the model field). Baseline 3 applies.

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 states a specific verb and resource — generating images through the OpenAI Images API (/v1/images/generations) — and names the supported model families. It is clear on its own but never distinguishes itself from the siblings generate_image_via_responses or edit_image, leaving the agent to infer the boundary.

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

Usage Guidelines2/5

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

There is no statement of when to prefer this tool over generate_image_via_responses or edit_image, no prerequisites, and no exclusions. The only routing signal is the API endpoint, which an agent must interpret itself.

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