Skip to main content
Glama

extract_palette

Extracts the unique colors used in a sprite or image and returns them as a #RRGGBBAA list, optionally applying them as the file's palette.

Instructions

Extract the unique colours used in a sprite (or another image).

Args:
    from_image: Optional image/sprite to scan instead of `filename`.
    set_as_palette: Apply the extracted colours as `filename`'s palette.
    include_alpha: Treat differing alpha as distinct colours (default off).
    max_colors: Error out if more unique colours than this are found.

Returns the list of "#RRGGBBAA" colours found.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameYes
from_imageNo
max_colorsNoDefault: 256.
include_alphaNoDefault: false.
set_as_paletteNoDefault: true.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed12 schema fields changedv0.10.0
    • removedInput schema / properties / filename / title
      Removed value: -"Filename"
    • removedInput schema / properties / from_image / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedInput schema / properties / from_image / default
      Removed value: -null
    • removedInput schema / properties / from_image / title
      Removed value: -"From Image"
    • addedInput schema / properties / from_image / type
      Added value: +"string"
    • addedInput schema / properties / include_alpha / description
      Added value: +"Default: false."
    • removedInput schema / properties / include_alpha / title
      Removed value: -"Include Alpha"
    • addedInput schema / properties / max_colors / description
      Added value: +"Default: 256."
    • removedInput schema / properties / max_colors / title
      Removed value: -"Max Colors"
    • addedInput schema / properties / set_as_palette / description
      Added value: +"Default: true."
    • removedInput schema / properties / set_as_palette / title
      Removed value: -"Set As Palette"
    • removedInput schema / title
      Removed value: -"extract_paletteArguments"
  2. First observedv0.7.0

TDQS

A3.8/5.0
Behavior4/5

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

Annotations declare readOnlyHint=false, and the description corroborates this by explaining that set_as_palette (default true) writes the extracted colours into filename's palette — so the mutating behavior is disclosed rather than hidden. It also documents the error path for max_colors, though it says nothing about permissions or how a failure leaves the 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?

One framing sentence, a tight per-argument list, and a return-type line. It is front-loaded and every line earns its place, with only minor redundancy between the arg list and the schema defaults.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 5-parameter tool with no output schema, the description covers the optional arguments, the mutation semantics, the error condition, and the return format ('#RRGGBBAA' list). Its one substantive gap is routing guidance against the cluster of palette siblings.

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 only 60% and the schema descriptions are boilerplate ('Default: 256.'), so the description does real work: it explains from_image as an override for filename, include_alpha as treating differing alpha as distinct colours, and max_colors as an error threshold. Only filename itself is left without explanation.

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 states a specific verb and resource: 'Extract the unique colours used in a sprite (or another image)'. That is clear enough to identify the operation, but it never distinguishes itself from nearby siblings like get_palette, quantize_palette, or list_palette_usage, which an agent must sort out on its own.

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?

Usage is only implied: the from_image and set_as_palette arguments hint at the two modes (scan an external image vs. re-palette the target file), but there is no explicit when-to-use or when-not statement. No alternative tool is named despite get_palette/set_palette/quantize_palette sitting right beside it.

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

Deploy Server

Other Tools