Skip to main content
Glama

quantize_to_palette

Snap every visible pixel in an RGB sprite layer to a non-transparent palette color chosen by RGB distance while preserving alpha; empty frames are skipped and indexed or grayscale sprites are rejected.

Instructions

Snap every visible pixel of a layer of an RGB sprite to its nearest palette colour.

Nearest is by RGB distance among the palette's non-transparent entries; each pixel keeps its alpha. Indexed sprites (pixels are palette entries already) and grayscale sprites (their palette is always the 256 grays) are refused. Frames without a cel are skipped. Linked cels are handled like replace_colors. changed counts the pixels that got a new value.

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>"
    },
    "name": "quantize_to_palette"
  }
}

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)

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.8/5.0
Behavior3/5

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

No annotations are supplied, so the description carries the full behavioural burden, and it does well: nearest-colour metric (RGB distance, non-transparent palette entries only), alpha preservation, refusal cases, cel-skipping, and that 'changed' counts modified pixels. It leaves the cross-reference "Linked cels are handled like replace_colors" undefined here and says nothing about failure modes such as an empty or missing palette.

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?

Dense but front-loaded — the core action leads, then constraints, then the return counter. A few phrases ("handled like replace_colors") are opaque without opening the sibling tool, which is the only real waste.

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, so return values needn't be explained, and the description covers selection semantics and refusal behaviour well. For a mutating raster operation with zero annotations, though, it should say whether the write is in-place/undoable and what happens on error or a palette-less sprite.

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%, so path, layer and frames are already documented with formats and defaults; the description adds no parameter-level detail beyond what the schema states. Baseline 3 applies when the schema does the heavy lifting.

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 ("Snap every visible pixel of a layer ... to its nearest palette colour") and pins the domain to RGB sprites by explicitly refusing indexed and grayscale sprites, so an agent can distinguish this from colour-adjustment siblings without opening a schema.

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?

Gives concrete eligibility rules — indexed and grayscale sprites are refused, frames without a cel are skipped — which tells the agent when the call will silently do less than expected. It stops short of naming a positive alternative (e.g. set_palette or adjust_colors) for the refused cases, so it is clear context without explicit alternatives.

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