Skip to main content
Glama

Colour palette from image

image_palette
Read-onlyIdempotent

Extract an image's main colors with their percentage share, returning hex/RGB values as CSS variables or JSON and optionally saving a swatch PNG.

Instructions

Extract the main colours of an image with their share of the picture: k-means (default, deterministic) or median cut, 1-16 colours, sorted by share. Transparent pixels are ignored. Returns hex + rgb + % per colour, CSS custom properties (:root { --color-1 … }) or JSON, and optionally writes the website's swatch strip as palette.png. Same algorithm and sampling as the website, so the colours match. Web version: https://s3eidat.github.io/palette-from-image/

Input Schema

NameRequiredDescriptionDefault
countNoNumber of colours. Default 6.
imageYesThe image: a local file path (absolute, or relative to the server's --root) or base64 data (raw or a data: URI).
formatNoExport text format. Default css.css
methodNokmeans (default) or median (median cut).kmeans
outputNoWhere to write palette.png (file path or folder ending in "/"). Implies swatchPng.
swatchPngNoAlso write palette.png (160×200 swatch per colour with its hex code).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

Adds real context beyond annotations: transparent pixels are ignored, sampling matches the website so results are reproducible, and output/swatchPng cause a palette.png to be written. That last point is worth flagging as mild tension with readOnlyHint=true, since the tool can create a file, but the description discloses the side effect rather than hiding it.

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-loads the core action and scope, then tacks on output/format detail. It is dense but every clause carries information; only the website URL is arguably expendable.

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 fully covers return values (hex + rgb + % per colour, CSS :root custom properties, JSON) and the optional PNG artifact, which is exactly what an agent needs to interpret results.

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 the baseline is 3; the description only reinforces what the schema already says (1-16 range, default kmeans, output implies swatchPng) without adding new semantics such as path resolution rules or format precedence.

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 ('Extract the main colours of an image') plus quantitative scope (1-16 colours, share of picture). Easily distinguished from neighbouring image tools such as image_diff, image_ascii_art, or image_resize, which do not analyse colour.

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?

Names the two algorithmic options with the default called out (kmeans default/deterministic, median cut alternative) and explains what swatchPng/output add. It gives clear selection context but no explicit 'when not to use' or exclusion guidance.

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