Skip to main content
Glama

Check WCAG color contrast

check_contrast
Read-onlyIdempotent

Compute the WCAG 2.x contrast ratio between a text (foreground) color and a background color, with pass/fail for AA, AA large text, AAA, AAA large text and non-text UI (3:1). Handles translucent colors. Read-only. Same engine as GET /api/contrast.

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

Input Schema

NameRequiredDescriptionDefault
backgroundYesBackground color as a CSS color: "#1a73e8", "#fff", "rgb(26 115 232)", "hsl(217 80% 51%)", "rgba(0,0,0,.6)" or a name like "navy".
foregroundYesText / foreground color as a CSS color: "#1a73e8", "#fff", "rgb(26 115 232)", "hsl(217 80% 51%)", "rgba(0,0,0,.6)" or a name like "navy".

Output Schema

NameRequiredDescriptionDefault
passYes
notesYes
ratioYes
versionYes
backgroundNo
foregroundNo
ratioExactNo
effectiveBackgroundNo
effectiveForegroundNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.7/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint=false, so the safety profile is covered. The description still adds useful behavior: translucent colors are supported and the result includes AA, AA large, AAA, AAA large, and non-text UI 3:1 pass/fail outcomes.

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 core computation is front-loaded, followed compactly by translucency support, read-only status, and API parity. The read-only note is redundant with annotations, but otherwise the description is efficient and well-structured.

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 simple two-parameter read-only computation with a complete input schema and an output schema, the description provides enough context: what is computed, which WCAG thresholds are returned, and that translucent colors are supported. Error behavior for invalid colors is left implicit, which is a minor gap.

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%, and both parameters already document accepted CSS color formats in detail. The description only restates the foreground/background roles and adds no syntax or constraint information beyond the schema, so the baseline of 3 applies.

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?

It states a specific verb and resource: compute the WCAG 2.x contrast ratio between foreground and background colors, including the pass/fail thresholds evaluated. It is clear what the tool does, but it does not explicitly distinguish itself from siblings such as suggest_accessible_color or check_palette.

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 description implies usage for WCAG contrast compliance checks and notes that translucent colors are handled. However, it gives no explicit when-to-use/when-not guidance or routing to alternative tools like suggest_accessible_color when contrast fails.

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