Skip to main content
Glama

Check a colour pair against WCAG

check_contrast
Read-only

Verify WCAG 2.2 contrast ratios for foreground/background pairs, including transparent and token colors, and compare against the threshold for body text, large text, or UI components.

Instructions

WCAG 2.2 contrast for the rendered foreground/background pair. Supports hex, transparent, modern rgb() and token names. Composites background over an explicit opaque backdrop, or the disclosed theme base when omitted, then foreground over that background.

Input Schema

NameRequiredDescriptionDefault
useNoWhat the pair is for. Drives the threshold: 4.5:1 body, 3:1 large text and UI components.
themeNoTheme to resolve token names in (default light).
backdropNoOpaque hex/CSS colour or token beneath the background. Defaults to the selected theme base, disclosed in the result.
backgroundYesHex/CSS colour, or a token name.
foregroundYesHex value, or a token name like "color-text-primary".

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv3.2.1
    • addedInput schema / properties / backdrop
      Added value: +{
      +  "description": "Opaque hex/CSS colour or token beneath the background. Defaults to the selected theme base, disclosed in the result.",
      +  "type": "string"
      +}
    • changedInput schema / properties / background / description
      Previous value: -"Hex value, or a token name."New value: +"Hex/CSS colour, or a token name."
  2. Changed1 schema field changedv2.1.0
    • removedInput schema / additionalProperties
      Removed value: -false
  3. First observedv1.0.0

TDQS

A3.8/5.0
Behavior4/5

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

Annotations only declare readOnlyHint and openWorldHint; the description adds real behavioral context beyond them, namely the compositing order (background over an explicit opaque backdrop or the theme base, then foreground over that) and acceptance of transparent values. It does not disclose rate limits or the returned pass/fail shape, so it falls short of 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?

Three sentences, front-loaded with the core purpose and standard, followed by supported formats and the compositing rule. No filler, no repetition of the title, and each sentence carries distinct information.

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 annotations covering safety, full schema coverage, and no output schema, the description covers purpose, formats, and compositing adequately. The one gap is that it never says what the call returns (contrast ratio, pass/fail against the threshold) despite no output schema existing to carry that burden.

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%, so all five parameters are already documented, including the enum-driven thresholds and the backdrop default. The description's format list (hex, transparent, rgb(), token names) largely restates the schema, so the baseline 3 is appropriate.

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?

States a specific verb (check) and resource (contrast of a foreground/background pair) against a named standard, WCAG 2.2, which is far more concrete than the title alone. It never names a sibling, so an agent must infer that audit_theme is the bulk-audit counterpart rather than being told.

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?

The `use` parameter and the compositing behavior imply the context (checking a single rendered pair rather than auditing a whole theme), but there is no explicit when-to-use/when-not or pointer to audit_theme/suggest_token as alternatives. Usage is inferable rather than stated.

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