Skip to main content
Glama

extract_palette

Extract a color palette from a PNG image using median-cut quantization. Returns hex colors and a swatch for use in pixel art creation.

Instructions

Extract a color palette from a PNG supplied as exactly one of png_base64 or path, with median-cut quantization, WITHOUT creating a document. Returns a list of hex colors ready to pass to create_document(palette=[...]) (or add_palette_color), plus a swatch render so the colors are visible. Use this to pull a palette from a reference image; use open_document when you also want its pixels.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoPath to a PNG on the server filesystem (mutually exclusive with png_base64)
sortNoOrder of the returned colors and swatch (default luminance, dark to light)
max_colorsNoMax colors to extract (default 16)
png_base64NoPNG file content, base64-encoded (mutually exclusive with path)
Behavior4/5

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

With no annotations provided, the description carries the full burden. It discloses that the tool does not create a document, returns hex colors and a swatch render, and is designed for extracting palettes. It could mention error conditions or side effects, but the given details are sufficient for safe use.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Description is three sentences, front-loaded with the core purpose, and every sentence adds necessary information. No redundant or vague phrasing.

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?

Given no output schema, the description adequately explains the return structure (list of hex colors + swatch). It covers parameter usage, algorithm, and integration with other tools. Could mention pagination or performance limits, but overall complete for a palette extraction tool.

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 100%, so baseline is 3. The description adds significant value: clarifying mutual exclusivity of 'path' and 'png_base64', explaining the quantization algorithm, and showing how output integrates with other tools (create_document, add_palette_color).

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?

The description clearly states the verb ('extract'), resource ('color palette from a PNG'), and method ('median-cut quantization'). It explicitly distinguishes itself from sibling tools like create_document and open_document by specifying 'WITHOUT creating a document' and contrasting with open_document.

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?

Provides explicit when-to-use ('Use this to pull a palette from a reference image') and when-not-to-use ('use open_document when you also want its pixels'). This directly guides the agent in selecting between sibling tools.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ehm-93/pixel-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server