Skip to main content
Glama

replace_colors

Replace colors in an Aseprite layer using multiple color mappings at once, with tolerance matching and optional transparency swaps across frames or regions.

Instructions

Replace colours in a layer, all mappings at once (A->B with B->A swaps them).

A pixel matches a mapping when each of r, g, b and alpha is within tolerance of from; fully transparent pixels count as 'transparent' whatever their colour. The first matching mapping wins. to='transparent' erases, except on a background layer, which ignores alpha and gets opaque black. On indexed sprites pixels are matched by their palette colour and get the palette entry nearest to to (exactly to when the palette has it); the palette is not changed. On grayscale sprites pixels compare as (v, v, v), so a coloured from only matches within tolerance, and to is stored as its gray value. Frames without a cel are skipped. Linked cels change once; one also linked to frames outside the list gets its own copy, only when some of its pixels change. replaced counts the pixels that matched.

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": {
      "path": "<path>",
      "layer": "<layer>",
      "mappings": "<mappings>"
    },
    "name": "replace_colors"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesSprite file. Relative paths resolve against the server root.
layerYesLayer name, or a 'group/child' path for nested layers
framesNoFrames: a number, "1-4", "1-4,7" or "all" (1-based)
regionNoOnly change pixels inside this canvas rectangle; default the whole cel
mappingsYes[{"from": colour, "to": colour}]
toleranceNoLargest difference per channel (r, g, b, a) that matches

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/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 behavioral burden and does so thoroughly. It explains matching rules, tolerance semantics, transparency handling, background-layer exceptions, indexed and grayscale palette behavior, frame/cel skipping, linked-cel copying, and what the replaced count means. This is unusually complete behavioral disclosure for a mutation tool.

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?

The description is front-loaded with the core operation and then systematically covers edge cases. It is somewhat long because it documents many special cases, but each sentence carries relevant behavioral information. There is little redundant wording.

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 a six-parameter mutation tool with no annotations and an output schema, the description is complete enough for correct invocation. It covers matching, tolerance, transparency, palettes, frames, linked cels, and the `replaced` output. Return value details are appropriately left to the output schema.

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 already 100%, so the baseline is 3, but the description adds meaningful semantics about how mappings, tolerance, transparent values, and frames interact. It clarifies that the first matching mapping wins, that tolerance applies per channel, and that transparent `to` erases except on background layers. It does not explicitly describe every parameter, such as `region`, but the added meaning is substantial.

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 gives a specific verb and resource: replacing colours in a layer. It also distinguishes this operation by noting that all mappings are applied at once and that A->B with B->A swaps colours. It does not explicitly name or contrast with siblings such as adjust_colors, so sibling differentiation is implied rather than stated.

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?

The description implies when to use this tool by emphasizing bulk mapping and swap semantics, but it does not explicitly state when to choose it over adjust_colors or other colour tools. No exclusions or prerequisites are given. The usage context is clear enough to infer but not fully guided.

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