Skip to main content
Glama

image_batch_edit

Apply the same edit to multiple images in one batch, each processed independently with the given prompt and size, returning per-image success or error results.

Instructions

批量图像编辑:N 张输入图 → N 张输出图,每张独立应用同一指令。

[WHAT] 对 image_paths 里的每一张图分别调用 image_edit,统一 prompt 与 size,结果合并返回。

[WHEN TO USE]

  • 用户提供多张图且每张要做"同样的修改"(如批量加水印 / 统一换底 / 统一调色)→ 用此 tool。

  • 如果是"用多张图作风格参考画 1 张新图" → 这不是此 tool,暂未实现。

  • 如果只有 1 张图 → 用 image_edit。

[并发策略]

  • gpt-image-2:5 并发(HTML 网页同款)。

  • gpt-image-2-openai:串行 + 1.5s gap(高质量线路并发更容易被限流)。

  • 任意一张失败不影响其他张;返回 results 里逐张标 ok/error。

[LIMITS]

  • 与 image_edit 一致支持 1K/2K/4K;2K/4K 自动切高质量线路并逐张串行。

  • image_paths 长度建议 2-20 张;高分辨率批次成本与耗时按图片数量线性增加。

Args: prompt: 应用到每张图的修改指令。例:"add a subtle watermark in bottom-right". image_paths: 输入图路径列表(绝对或相对)。 size: 输出 size,支持 1K/2K/4K;≥2K 自动使用高质量线路。默认 "1024x1024"。 model: "gpt-image-2" / "gpt-image-2-openai"。留空按 size 自动选。 save_dir: 输出目录(必须在安全根目录之下)。文件名 batch__.png。 api_key: 覆盖 MICU_API_KEY;base_url 已锁在启动期 env,运行期不接受。

Returns: dict 含: ok (bool): True 表示至少 1 张成功。 total (int): 输入图总数。 succeeded (int): 成功张数。 failed (int): 失败张数。 concurrency (int): 实际用的并发度(5 或 1)。 results (list[dict]): 每张图的详细结果(含 input 路径、saved.path、可能的 error)。

Examples: image_batch_edit( prompt="convert to pencil sketch style", image_paths=["/p/a.jpg", "/p/b.jpg", "/p/c.jpg"], size="1024x1024", )

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sizeNo1024x1024
modelNo
promptYes
api_keyNo
save_dirNo
image_pathsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A5/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden and delivers rich behavioral detail: concurrency strategy (5 for gpt-image-2, serial+1.5s gap for the openai line), failure isolation ('任意一张失败不影响其他张'), high-resolution auto-switching to serial processing, rate-limit risk disclosure, and note that cost/time scale linearly with batch size. This exceeds what any annotation set would typically provide.

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

Conciseness5/5

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

Well-structured with clear section headers ([WHAT], [WHEN TO USE], [并发策略], [LIMITS], Args, Returns, Examples) and front-loaded summary. Though long, every block earns its place — this is a complex 6-parameter batch tool with output-format documentation and routing logic; the length is proportionate to the complexity. No filler or redundant restatement.

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, 0% schema coverage, and an output schema, the description covers everything an agent needs: input parameter semantics, return format (ok/total/succeeded/failed/concurrency/results), concurrency and failure behavior, limits, and a working example. The presence of an output schema relaxes the burden on return-value explanation, and the description still documents it. Complete.

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 description coverage is 0%, so the description must compensate, and it does so thoroughly. The Args section gives each parameter real meaning beyond the schema titles: prompt gets an example, size gets the 1K/2K/4K values and default, model gets the two accepted values, save_dir gets the filename pattern batch_<ts>_<idx>.png and the security-root constraint, api_key gets its MICU_API_KEY override behavior with base_url locking noted. Full compensation for the coverage gap.

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 opening line states a precise verb+resource+scope: 'N 张输入图 → N 张输出图,每张独立应用同一指令' (batch edit N images, each independently applying the same instruction). The [WHAT] section plainly states it calls image_edit per image and merges results. It differentiates itself from siblings by explicitly declaring '用多张图作风格参考画 1 张新图' is NOT this tool, and routes single images to image_edit. 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?

The [WHEN TO USE] section gives explicit selection criteria: use this tool when the user has multiple images all needing the same modification (watermark, background, color grading), use image_edit for a single image, and explicitly states the multi-reference case is not implemented. It also adds concurrency strategy per model line. Nothing is left to inference.

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