Skip to main content
Glama

Check a color pair

check_contrast
Read-onlyIdempotent

Calculates the WCAG contrast ratio between foreground and background colors and verifies if it passes AA or AAA for the given text size and weight.

Instructions

Calculate the WCAG contrast ratio for foreground and background colors and determine whether the pair passes for the supplied text size and weight.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
levelNoAA
backgroundYesBackground CSS sRGB color such as white, #ffffff, rgb(), hsl(), or color(srgb ...).
fontSizePxNo
fontWeightNo
foregroundYesForeground CSS sRGB color such as white, #767676, rgb(), hsl(), or color(srgb ...).

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv0.1.4

TDQS

A3.8/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint as false, so the tool's safe behavior is clear. The description adds value by explaining the return includes ratio and pass/fail for given text size/weight, but does not disclose any edge cases (e.g., handling of transparent colors, out-of-gamut colors) or limits (e.g., only sRGB). A 3 is appropriate as annotations carry the safety burden.

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 description is a single sentence that front-loads the main action and includes key details (ratio, pass determination, text attributes). It is concise and efficient, though it could be slightly more scannable by breaking into two sentences. No redundancy is present.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 5 parameters (2 required) and no output schema, the description covers the main computation (contrast ratio and pass/fail) but omits specifics about return format (e.g., numeric ratio, boolean pass, object). For a calculation tool with moderate complexity, additional context about the scope (sRGB only) or limitations (e.g., does not handle transparency) would improve completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 40%, so the parameter descriptions in the schema partially explain foreground/background colors as 'CSS sRGB color'. However, the tool description clarifies that both 'fontSizePx' and 'fontWeight' are used to determine the pass level, adding meaning beyond the schema's default values and constraints. It compensates for the missing schema descriptions on those parameters, though the level parameter's enum (AA, AAA) is already clear in the schema.

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 clearly states the verb 'Calculate' and the resource 'WCAG contrast ratio', and distinguishes the tool from siblings like 'suggest_contrast_fix' by specifying the output includes both the ratio and a pass/fail determination based on text size and weight.

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 checking color contrast but does not explicitly state when to use this tool versus alternatives like 'suggest_contrast_fix'. It lacks guidance on prerequisites or context (e.g., checking multiple pairs vs. one). Without sibling differentiation, the agent may not know when to choose this over other audit tools.

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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aditya-ariosity/wcag-accessibility-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server