Skip to main content
Glama
Colors MCP Server

Colors MCP Server

by HtetOoWaiYan

Convert colors

colors_convert
Read-onlyIdempotent

Converts color values between formats like hex, RGB, HSL, OKLCH, Lab, P3, and Rec.2020, handling lists and out-of-gamut mapping.

Instructions

Convert colors to another format: hex, rgb, hsl, hwb, hsv, oklch, oklab, CSS lab/lch (D50), lab-d65/lch-d65 (CIELAB, D65, no adaptation), xyz (D65), linear (linear sRGB), p3, rec2020 (CSS, 2.4 gamma), rec2020-oetf (BT.2020 transfer) or rec2020-linear. Reads any of them as input. Handles lists. A color outside sRGB (for hex/rgb/hsl/hwb) is mapped in by lowering chroma only, and the result says so.

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": {
      "colors": "<colors>",
      "to": "<to>"
    },
    "name": "colors_convert"
  }
}

Input Schema

NameRequiredDescriptionDefault
toYesTarget format. "lab"/"lch" are the CSS ones (D50); "lab-d65"/"lch-d65" use the D65 white, no adaptation. "xyz" is D65, "linear" is linear sRGB, "p3" is display-p3, "rec2020" has a 2.4 gamma, "rec2020-oetf" the BT.2020 curve.
colorsYesColors to convert. A list, even for a single color. Any CSS color strings.
precisionNoDecimal places. Default 3.

Output Schema

NameRequiredDescriptionDefault
toYes
resultsYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed10 schema fields changedv2.1.0
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • removedInput schema / additionalProperties
      Removed value: -false
    • removedInput schema / properties / color
      Removed value: -{
      -  "description": "Color string in any supported format (e.g., \"#ff0000\", \"red\", \"rgb(255, 0, 0)\", \"oklch(0.6 0.2 29)\")",
      -  "minLength": 1,
      -  "type": "string"
      -}
    • addedInput schema / properties / colors
      Added value: +{
      +  "description": "Colors to convert. A list, even for a single color. Any CSS color strings.",
      +  "items": {
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  "maxItems": 50,
      +  "minItems": 1,
      +  "type": "array"
      +}
    • changedInput schema / properties / precision / description
      Previous value: -"Decimal places for output values (0-10)"New value: +"Decimal places. Default 3."
    • changedInput schema / properties / precision / maximum
      Previous value: -10New value: +8
    • changedInput schema / properties / to / description
      Previous value: -"Target color space"New value: +"Target format. \"lab\"/\"lch\" are the CSS ones (D50); \"lab-d65\"/\"lch-d65\" use the D65 white, no adaptation. \"xyz\" is D65, \"linear\" is linear sRGB, \"p3\" is display-p3, \"rec2020\" has a 2.4 gamma, \"rec2020-oetf\" the BT.2020 curve."
    • changedInput schema / properties / to / enum
      Previous value: -[
      -  "hex",
      -  "rgb",
      -  "hsl",
      -  "oklch",
      -  "oklab",
      -  "p3",
      -  "lab",
      -  "lch"
      -]New value: +[
      +  "hex",
      +  "rgb",
      +  "hsl",
      +  "hwb",
      +  "oklch",
      +  "oklab",
      +  "lab",
      +  "lch",
      +  "lab-d65",
      +  "lch-d65",
      +  "p3",
      +  "rec2020",
      +  "rec2020-oetf",
      +  "rec2020-linear",
      +  "xyz",
      +  "linear",
      +  "hsv"
      +]
    • changedInput schema / required
      Previous value: -[
      -  "color",
      -  "to"
      -]New value: +[
      +  "colors",
      +  "to"
      +]
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "https://json-schema.org/draft/2020-12/schema",
      +  "additionalProperties": false,
      +  "properties": {
      +    "results": {
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "gamutMapped": {
      +            "type": "boolean"
      +          },
      +          "input": {
      +            "type": "string"
      +          },
      +          "output": {
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "input",
      +          "output",
      +          "gamutMapped"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "to": {
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "to",
      +    "results"
      +  ],
      +  "type": "object"
      +}
  2. First observedv1.1.0

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, and non-destructive, so the safety profile is covered. The description adds real behavioral disclosure beyond that: 'Handles lists' and the out-of-gamut rule ('mapped in by lowering chroma only, and the result says so'), which tells the agent the conversion never fails on out-of-gamut input and that the output flags the mapping. It does not mention the 50-color cap or error behavior, but those are secondary.

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 core purpose is front-loaded in the first clause, and the long format enumeration in the middle earns its space because it defines accepted input as well as output. The parenthetical format qualifiers are dense but functional; the only minor redundancy is restating enum values that also appear in the schema.

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?

For a 3-parameter conversion tool with full schema coverage and an output schema, the description covers purpose, accepted input formats, list handling, and the gamut-mapping outcome — including that the result reports the mapping. Nothing an agent needs in order to invoke it correctly is missing.

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 the baseline is 3, and the description clears that bar by clarifying that all of the listed formats — including non-CSS ones like hsv, xyz, linear, and p3 — are accepted as input, which the schema only weakly conveys with 'Any CSS color strings'. It also disambiguates the lab/lch vs lab-d65/lch-d65 naming, though it does not touch precision.

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 opens with a specific verb and resource ('Convert colors to another format') and then enumerates the exact format set, so the agent knows this is a format-transformation tool, not a modification, blending, or repair tool like the sibling colors_adjust/colors_blend/colors_fix. It also states the inverse capability ('Reads any of them as input'), which no sibling implies.

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 implied rather than stated: the format list and 'Reads any of them as input' make it clear this is the tool for changing representation, but there is no explicit when-to-use sentence, no mention of when to prefer colors_adjust or colors_check, and no prerequisites. An agent can infer the case, but nothing routes it away from misuse.

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