Skip to main content
Glama

WCAG contrast for color pairs, with fixes

check_contrast
Read-only

Calculate exact WCAG 2.x contrast ratios for up to 50 foreground/background pairs, return AA/AAA pass status, and suggest the nearest passing foreground for failed pairs.

Instructions

Exact WCAG 2.x contrast ratios for up to 50 foreground/background pairs (hex, rgb(), hsl(), oklch(), alpha blended). Returns AA/AAA pass and, for failures, the nearest passing foreground color in the same hue.

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": {
      "pairs": "<pairs>"
    },
    "name": "check_contrast"
  }
}

Input Schema

NameRequiredDescriptionDefault
pairsYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.0.0

TDQS

A4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, and the description adds meaningful behavior: the 50-pair cap, accepted color notations with alpha blending, and what is returned (AA/AAA pass plus a hue-preserving suggested fix). It stops short of stating error behavior for malformed colors, but covers the operation's effects well.

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?

Two dense sentences with zero filler; the core capability, scope limit, and return behavior are all front-loaded.

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 stateless read-only computation with no output schema, the description adequately explains inputs and outputs. The only notable omission is the meaning of the large_text flag, which affects the pass threshold.

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 0%, so the description does real work by explaining that fg/bg accept hex, rgb(), hsl(), oklch(), and alpha-blended values. The 'large_text' field is never mentioned, leaving a parameter with real WCAG threshold implications (3:1 vs 4.5:1) undocumented.

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 the exact computation (WCAG 2.x contrast ratios) and resource (foreground/background color pairs), plus scope limits ('up to 50') and supported color syntaxes. This clearly distinguishes it from siblings like lint_design and design_checklist, which do not compute contrast ratios.

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 the batch limit and the remediation behavior ('for failures, the nearest passing foreground color'), suggesting it is used for auditing many color pairs at once. However, there is no explicit when-to-use or when-not-to-use guidance and no named alternative for related checks.

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