Skip to main content
Glama

CSS color strings

css
Read-onlyIdempotent

Convert any color space or string into web color strings like rgb(), oklch(), lab(), and hex, preserving out-of-gamut values.

Instructions

A color as CSS Color 4 strings — rgb(), hsl(), hwb(), lab(), lch(), oklab(), oklch() and color(display-p3 | a98-rgb | prophoto-rgb | rec2020 | srgb-linear | xyz-d65 | xyz-d50) — plus #hex inside sRGB. Converted, never gamut-mapped: a string is null where CSS would clamp it into a different color (rgb/hsl/hwb outside sRGB, lightness out of range). gamut is the smallest display gamut that holds the color.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromNosource space id, e.g. 'rgb', 'oklch', 'lab', 'slog3', 'rec709' (the 'spaces' tool lists all 221)
colorNoa CSS color instead of `from` + `values`: '#ff8000', 'rebeccapurple', 'oklch(0.7 0.1 50)', 'lab(54% 80 67)', 'color(display-p3 1 0.5 0)'
valuesNoone color in the source space
notationsNoonly these, by library space id (default: all)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
cssYes
hexYes
gamutYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv3.5.0
    • changedInput schema / properties / from / description
      Previous value: -"source space id, e.g. 'rgb', 'oklch', 'lab', 'slog3', 'rec709' (the 'spaces' tool lists all 205)"New value: +"source space id, e.g. 'rgb', 'oklch', 'lab', 'slog3', 'rec709' (the 'spaces' tool lists all 221)"
    • changedInput schema / properties / notations / items / enum
      Previous value: -[
      -  "rgb",
      -  "hsl",
      -  "hwb",
      -  "lab",
      -  "lchab",
      -  "oklab",
      -  "oklch",
      -  "p3",
      -  "a98rgb",
      -  "prophoto",
      -  "xyz",
      -  "xyz-d50",
      -  "lrgb"
      -]New value: +[
      +  "rgb",
      +  "hsl",
      +  "hwb",
      +  "lab",
      +  "lchab",
      +  "oklab",
      +  "oklch",
      +  "p3",
      +  "a98rgb",
      +  "prophoto",
      +  "rec2020-display",
      +  "xyz",
      +  "xyz-d50",
      +  "lrgb"
      +]
  2. First observedv0.1.0

TDQS

A3.9/5.0
Behavior5/5

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

Annotations already cover the safety profile (readOnly, idempotent, non-destructive), and the description still adds non-obvious behavior: conversion is done 'never gamut-mapped', output is `null` exactly where CSS would clamp (out-of-sRGB rgb/hsl/hwb, out-of-range lightness), and `gamut` reports the smallest display gamut holding the color. These are genuine semantic traits an agent could not infer from the schema.

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-loaded with the resource (CSS color strings), followed by the supported notation set and the two behavioral caveats. It is dense and almost every clause carries information, though the inline notation list is long and partially overlaps the schema's enum ids.

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?

With an output schema present, return structure needn't be explained, yet the description still clarifies the meaning of the `null` result and the `gamut` field, which is exactly the missing context for a conversion tool. Annotations plus full schema coverage leave no major gaps; only edge cases like precedence between the two input modes are unstated.

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 `from`, `color`, `values`, and `notations` are already documented at the parameter level, establishing the baseline of 3. The description adds little parameter-specific detail beyond the output-side null/gamut semantics; it does not, for example, explain precedence when both `color` and `from`+`values` are supplied.

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 concrete output resource – CSS Color 4 strings – and enumerates the exact notations produced (rgb(), hsl(), lab(), oklch(), color(display-p3 ...), #hex), so an agent knows precisely what this tool returns. The verb is implicit ('Converted') and it never names or contrasts with the sibling `convert`, so sibling differentiation is left to the name.

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 schema shows it accepts either `from` + `values` or a `color` string, and the description implies conversion into CSS syntax. There is no explicit statement of when to pick this over `convert`, `gamut`, or `space`, and no exclusions or prerequisites.

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