Skip to main content
Glama

AiImageLayerSplit

AI 拆分图层:把一张图拆成可单独绘制的图层,并返回画布尺寸和每层坐标。本工具提交后立即返回任务信息,不阻塞等待生成;请按返回的轮询参数调用 GetTask 取结果。

【上传图片】本工具不接收 base64 或 URL,只接收文件 id:

  1. 先调用 CreateUploadUrl 拿到 fileId 与 uploadUrl;

  2. uploaded=false 时把文件字节 PUT 到 uploadUrl,必须让命令读取文件内容(curl 用 --data-binary @文件路径,漏掉 @ 会把路径字符串当内容上传且仍返回 200),上传后核对字节数与本地文件大小一致;

  3. 把 fileId 填入 image。

【必填字段】

  • image:图片文件 id,仅 1 张。仅支持 JPG / PNG / WebP,单张不超过 10MB,图片宽高需在 100-4096 px 之间。不接收 base64 或 URL。上传前先确认符合要求,不符合时提示用户更换图片。

  • resolution:输出分辨率,只能是 1K 或 2K。用户没指定时先询问,不要自行假设。

【异步与轮询】成功提交后返回 JSON:taskId、initialSleepSeconds、intervalSeconds。 先按 initialSleepSeconds 等待,再按 intervalSeconds 间隔调用 GetTask(taskId),直到 status 为 completed 或 failed。

【如何用结果画图层】completed 时 result 不是地址数组,结构如下:

  • result.canvas:原图画布。width、height 是画布像素,size 为「宽x高」,url 是原图。

  • result.layers:拆出的图层,数组顺序就是从下到上的叠放顺序,zIndex 从 0 递增。 每层含 url、width、height、size,以及 boundingBox。 boundingBox.absolute 与 left、top、right、bottom 都是画布上的像素坐标,顺序为左、上、右、下。 boundingBox.normalized 是 0–1000 的归一化坐标,顺序相同;像素约为 normalized/1000*画布对应边。优先用 absolute。 绘制时:按 canvas 的宽高建立画布,再按 layers 从下到上把每层图片贴到对应矩形(宽 = right-left,高 = bottom-top)。图片 URL 有时效性,写脚本或展示前先下载到本地。 不要改写这些坐标和地址。message 按用户当前对话语言翻译,不要强行中文;Markdown 链接必须完整保留,链接地址不要改。

【回复要求】工具返回的内容就是给用户的最终文案,按用户当前对话语言转达,不要强行中文:可以翻译措辞,不要改写事实、精简、扩写或自行追加建议、总结或客套话。 返回体是 JSON 时,转达其中面向用户的文案字段(如 message);是纯文本时转达整段。 文案中的 Markdown 链接(例如 莱诺鸟)必须完整保留,链接地址以工具返回的为准;链接文字随回复语言调整:中文用「莱诺鸟」,非中文一律用 rhinobird,禁止在非中文回复中保留「莱诺鸟」;严禁降级成「莱诺鸟(lainuoniao.com)」「lainuoniao.com」这类纯文本,否则用户无法点击跳转。 任务编号、积分数字、链接地址保持原样。成功、积分不足、生成失败、超时等所有场景都按此规则处理。 媒体与图片地址是服务端签发的短链(形如 …/api/v1/explorer/media/s/8 位短码),必须整段原样使用:不要拼接、补全、截断或改写,也不要自己拼 OSS / CDN 地址。

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": {
      "image": "<image>",
      "resolution": "<resolution>"
    },
    "name": "AiImageLayerSplit"
  }
}

Input Schema

NameRequiredDescriptionDefault
imageYes图片文件 id,必填,仅 1 张。文件 id 由 CreateUploadUrl 返回(32 位 md5)。仅支持 JPG / PNG / WebP,单张不超过 10MB,图片宽高需在 100-4096 px 之间。不接收 base64 或 URL。上传前先确认符合要求,不符合时提示用户更换图片。
resolutionYes输出分辨率,必填,只能是 1K 或 2K。

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Annotations only declare the safety profile (readOnlyHint=false, destructiveHint=false, non-idempotent), leaving async behavior, upload mechanics, and result shape undisclosed; the description covers all of them. It states the call returns immediately with taskId/initialSleepSeconds/intervalSeconds, that GetTask must be polled until completed/failed, and that media URLs are short-lived signed links to be downloaded before use. It also warns that dropping the '@' in curl still returns 200 with the wrong bytes, which is genuinely useful failure context.

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

Conciseness3/5

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

The purpose and prerequisites are front-loaded under bracketed headings, which aids scanning, but the text is long and repetitive — the 'no base64 or URL' restriction appears three times and the Markdown-link/rhinobird rules are restated at length. A sizeable share of the text governs how to phrase the reply rather than how to invoke the tool, diluting the call-relevant content.

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?

With no output schema, the description carries the full burden of documenting results, and it does: canvas width/height/size/url, layer ordering bottom-to-top with zIndex, both absolute and normalized boundingBox with field order, and the pixel math for reconstructing each layer rect. For a 2-parameter async media tool this leaves nothing an agent needs in order to call it and consume the result correctly.

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 meaning beyond it: image must be a fileId (32-char md5) produced by CreateUploadUrl and bytes must be verified after upload, and for resolution it instructs the agent to ask the user rather than default when unspecified. This is real added guidance over a plain enum of 1K/2K.

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 sentence names a specific verb and resource ('AI 拆分图层:把一张图拆成可单独绘制的图层') and states what is returned (canvas size and per-layer coordinates). It is immediately distinguishable from sibling image tools like Matting or ImageEdit because the layer/coordinate output is explicit.

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 strong pre-call conditions (only 1 JPG/PNG/WebP, ≤10MB, width/height 100–4096px), a mandatory prerequisite chain (CreateUploadUrl → PUT → fileId), and an explicit rule to ask the user when resolution is unspecified. It does not name a sibling alternative for the case where layer splitting is the wrong tool, which is what keeps it off a 5.

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.

Resources