Skip to main content
Glama

WCAG Color Contrast Checker API - AA/AAA Ratio, APCA & Auto-Fix Palette Matrix

color_contrast_checker
Read-onlyIdempotent

Calculate WCAG 2.1 relative luminance and contrast ratio (AA/AAA normal & large text + UI components) plus APCA Lc perceptual contrast for HEX, RGB, HSL, or named CSS colors. Returns closest passing auto-fix HEX suggestions when a pair fails, and an optional NxN brand palette matrix (up to 15 colors). 0 AI, deterministic, < 5 ms. Free: 5 calls/day per IP. Paid: Radar API key (from €15/mo at https://radarbg.com/pricing#starter via X-API-Key) or $0.001/call via x402 at https://radarbg.com/x402/color-contrast-checker.

Example tool call

This call uses example arguments supplied in the tool’s input schema.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "palette": [
        "#1E3A8A",
        "#FFFFFF",
        "#F59E0B",
        "#111827"
      ],
      "background": "#FFFFFF",
      "foreground": "#1E3A8A"
    },
    "name": "color_contrast_checker"
  }
}

Input Schema

NameRequiredDescriptionDefault
paletteNoOptional list of up to 15 colors to build a full NxN WCAG contrast matrix
backgroundNoBackground color (HEX, RGB, HSL, or CSS name)#FFFFFF
foregroundNoForeground/text color (HEX, RGB, HSL, or CSS name)#1E3A8A

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.4/5.0
Behavior5/5

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

Beyond readOnlyHint/idempotentHint, the description discloses determinism (0 AI), latency (< 5 ms), the free tier limit (5 calls/day per IP), and both paid auth paths (X-API-Key or x402 at $0.001/call). That is exactly the pricing and auth context an agent needs before invoking.

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 capability statement is front-loaded and dense with useful detail, but the pricing block with URLs and currency figures spills into the definition and reads more like marketing copy than invocation guidance.

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 carries the burden of explaining returns, and it does: ratio plus AA/AAA verdicts, APCA Lc, closest passing auto-fix HEX, and the optional matrix. Nothing essential for correct invocation is missing.

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 all three parameters including accepted color formats and the 15-color palette cap, so the description largely restates. It adds only that the palette produces an NxN matrix, which the schema already states.

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 names a specific verb and resource: calculate WCAG 2.1 relative luminance and contrast ratio plus APCA Lc, with an optional palette matrix. That clearly separates it from siblings like image_color_picker, which extract colors rather than evaluate them.

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?

Context is explicit: pass a foreground/background pair for compliance checking, or a palette for an NxN brand matrix, and auto-fix suggestions are offered when a pair fails. It never names an alternative tool or a when-not-to-use case, which keeps it below a 5.

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.

Resources