Skip to main content
Glama

Split an image into layers

extract_layers

Split an image into its separate pieces, as transparent layers: each layer is a new PNG asset that holds some of the picture's objects, cut out with their own edges, and transparent everywhere else. Stacked bottom to top they make the picture again. Use it to take a generated collage, poster or scene apart, so each piece can be placed, moved and animated on its own: a paper cut-out that drops in, a headline strip that slides, a background that stays still. The answer lists the layers bottom layer first. Look at each with read_asset before you place it: the model decides what goes in which layer. To cut one object or a logo out of its background, remove_background is enough. It answers at once with a Job ID and the media is made in the background: start every generation you need, keep working, then call wait_for_jobs with all their Job IDs to get each Asset ID for patch_film. Uses about 0.046 credits a layer: 4 layers use 1 credits.

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": {
      "assetId": "<assetId>",
      "layers": "<layers>",
      "caption": "<caption>",
      "projectId": "<projectId>"
    },
    "name": "extract_layers"
  }
}

Input Schema

NameRequiredDescriptionDefault
layersYesHow many layers to split it into, 2 to 8. null for 4. More layers separate smaller pieces.
assetIdYesThe ready image asset to split into layers. Use the IDs search_assets gives.
captionYesA short description of the whole picture, or null to let the model describe it. It does not choose what goes in each layer.
projectIdYesThe project this call runs on without changing the open project. null (or leaving it out) uses the open project. wait_for_jobs takes the projectId of the calls that started the jobs.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.6/5.0
Behavior5/5

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

Beyond the annotations (readOnlyHint=false, openWorldHint=true, non-idempotent, non-destructive), the description discloses the async job contract ('answers at once with a Job ID and the media is made in the background'), the polling step, layer ordering in the result, and a concrete cost model of about 0.046 credits per layer. That is substantial behavioral context an agent could not get from 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?

Front-loaded with the core action and output artifact, then usage, then operational flow, then cost — a sensible order. It is dense and longer than most definitions, but nearly every sentence carries actionable information; only the extended animation imagery ('a paper cut-out that drops in, a headline strip that slides') is decorative.

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 asynchronous, credit-consuming, non-idempotent generation tool with no output schema, the description covers the missing pieces: result ordering, the Job ID to Asset ID handoff via wait_for_jobs, per-layer pricing, and the alternative tool. An agent has everything needed to invoke it correctly and follow through.

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 100%, so all four parameters are already documented in the schema, including the 2–8 range, the null-means-4 default, and what caption does not control. The description reinforces the layer/model-composition point but adds little genuine meaning beyond the schema, so baseline 3 applies.

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?

States a specific verb and resource ('Split an image into its separate pieces, as transparent layers') and defines the output artifact precisely: each layer is a new PNG with cut-out edges and transparency elsewhere, stacked bottom-to-top to reconstruct the picture. It is clearly distinguishable from nearby tools by naming remove_background as the simpler alternative for a single object.

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?

Gives concrete when-to-use scenarios (taking apart a generated collage, poster or scene so pieces can be placed, moved, animated) and an explicit when-not/alternative rule: 'To cut one object or a logo out of its background, remove_background is enough.' It also routes the agent through the async flow by naming wait_for_jobs and patch_film as follow-ups.

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.