Skip to main content
Glama

check_contrast

Read-onlyIdempotent

Check contrast between foreground and background colors using WCAG 2.x or APCA, detect color-blindness contrast drops, and get a hue-preserving fix when accessibility fails.

Instructions

Check contrast between two colors using WCAG 2.x luminance ratio, APCA Lc (WCAG 3 draft), or both. Also checks color-blindness contrast drops and suggests an exact hue-preserving fix if contrast fails.

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

Input Schema

NameRequiredDescriptionDefault
algorithmNoContrast algorithm: 'wcag' (WCAG 2.x ratio), 'apca' (Lc, WCAG 3 draft), or 'both'wcag
backgroundYesBackground color
foregroundYesForeground/text color
suggestFixNoInclude nearest hue-preserving AA fix and CVD/optical warnings when issues exist

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.0.0

TDQS

A3.6/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and openWorldHint=false, so the safety profile is covered without the description. The text does add real behavioral value beyond that: it discloses that the check also reports color-blindness contrast drops and returns a hue-preserving fix suggestion when the pair fails, but it says nothing about the returned structure (pass/fail verdict, ratio values) or accepted color input formats.

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 sentences, zero filler. The core operation is front-loaded, the algorithm choice follows, and the secondary outputs (CVD drops, fix suggestion) come last in a natural reading order.

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 four-parameter, read-only tool with no output schema, the description covers the operation, the algorithm modes, and the two extra result types. Missing details about the shape of the verdict and the accepted color string formats are minor gaps rather than blockers for correct invocation.

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%, so both the enum values for algorithm and the suggestFix behavior are already documented in the schema. The description restates the algorithm options and the fix suggestion without adding syntax, format, or constraint details beyond what the schema provides, making this the baseline case.

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?

The description opens with a specific verb and resource ('Check contrast between two colors') and enumerates the algorithms used (WCAG 2.x ratio, APCA Lc, or both), so the agent knows exactly what the tool produces. It does not distinguish itself from siblings such as fix_contrast or check_palette_accessibility, which is the only thing keeping it from a 5.

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 only implied: 'between two colors' hints at single-pair checking versus a palette-level tool, and the fix-suggestion clause hints at overlap with fix_contrast, but neither is stated as when-to-use or when-not-to-use guidance. No prerequisites, no named alternatives.

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