Skip to main content
Glama

Convert a color and check contrast

convert_color
Read-onlyIdempotent

Convert HEX, RGB, HSL, OKLCH, or CMYK into every format, name the nearest Tailwind token, and report the WCAG 2 contrast ratio against a background.

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": {
      "color": "<color>"
    },
    "name": "convert_color"
  }
}

Input Schema

NameRequiredDescriptionDefault
colorYesHEX, rgb(), hsl(), oklch(), cmyk(), or a CSS color name.
backgroundNoBackground used for the WCAG contrast ratio.#ffffff

Output Schema

NameRequiredDescriptionDefault
okYes
hexYes
hslYes
rgbYes
cmykYes
oklchYes
aaLargeYes
aaNormalYes
aaaLargeYes
tailwindYes
aaaNormalYes
contrastTextYes
contrastRatioYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / additionalProperties
      Added value: +false
  2. First observed

TDQS

A4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, and openWorldHint=false, and the description adds real context on top: the tool is multi-format output, includes Tailwind nearest-token naming, and computes a WCAG 2 ratio against a background. It omits failure behavior for an unparseable color string, which keeps it from a 5.

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?

A single sentence that front-loads the accepted input formats and then the three outputs. Every clause carries information; nothing is redundant or padding.

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 two-parameter, read-only tool with an output schema, the description covers inputs, outputs, and the background-dependent contrast behavior. Only error handling for invalid color strings is unaddressed, a minor gap given the output schema carries return details.

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 coverage is 100% and the schema already documents both parameters, including the default '#ffffff' background and its role in the contrast ratio. The description restates the background purpose but adds no syntax or format nuance beyond the schema, so the baseline 3 applies.

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 (convert) plus the exact resource (a color) and enumerates all five accepted input formats. It goes further by naming the three outputs: every format, nearest Tailwind token, and WCAG 2 contrast ratio, which makes it unmistakable against siblings like convert_case, convert_units, or convert_data_format.

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 by 'convert ... into every format' — the agent can infer this is the one-stop color converter — but there is no explicit when-to-use, when-not-to-use, or named alternative. Nothing steers the agent away from, say, using a generic format converter for colors.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.