Skip to main content
Glama

Contraste WCAG

color-contrast
Read-onlyIdempotent

Calcula la relación de contraste WCAG 2.x entre dos colores, con resultados AA/AAA para texto normal, grande y componentes. Cuándo: hay que calcular con exactitud colores, contrastes o paletas, p. ej. para revisar accesibilidad. No para: encontrar el color más cercano (color-contrast-fix). Efectos secundarios: ninguno (solo lectura, sin red, sin estado guardado). Determinista: la misma entrada da la misma salida. Límites: entrada JSON de hasta 64 KB, 1 s por llamada, resultado de hasta 1 MB.

EN: Computes the WCAG 2.x contrast ratio between foreground and background colors (alpha composited over the background) with AA/AAA pass/fail for normal text, large text and UI components. When: color values, contrast or palettes have to be computed exactly, e.g. for accessibility checks. Not for: finding the closest color to a foreground (color-contrast-fix). Side effects: none (read-only, no network access, no stored state). [EN completo / full EN: inputSchema.description]

Input Schema

NameRequiredDescriptionDefault
backgroundYesBackground color (string; required; up to 100 chars).
foregroundYesText/foreground color (string; required; up to 100 chars).

Output Schema

NameRequiredDescriptionDefault
ratioNo
aa_largeNo
aa_normalNo
aaa_largeNo
aaa_normalNo
ui_componentsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / properties / background / examples
      Added value: +[
      +  "#fff"
      +]
    • addedInput schema / properties / foreground / examples
      Added value: +[
      +  "#000"
      +]
  2. Changed1 schema field changed
    • addedInput schema / description
      Added value: +"EN: Computes the WCAG 2.x contrast ratio between foreground and background colors (alpha composited over the background) with AA/AAA pass/fail for normal text, large text and UI components. When: color values, contrast or palettes have to be computed exactly, e.g. for accessibility checks. Not for: finding the closest color to a foreground (color-contrast-fix). Side effects: none (read-only, no network access, no stored state). Deterministic: the same input gives the same output. Limits: JSON input up to 64 KB, 1 s per call, result up to 1 MB."
  3. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-destructive/closed-world, yet the description adds real context: alpha compositing over the background, determinism, and concrete limits (64 KB input, 1 s per call, 1 MB result). This is information an agent cannot get from the annotations.

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?

Well front-loaded: purpose, then when/not-for, then side effects and limits. It loses a point for the bilingual duplication and the meta-fragment '[EN completo / full EN: inputSchema.description]', which adds length without adding information.

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

Completeness5/5

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

With an output schema present, the description need not explain return values; it instead covers invocation-relevant concerns — scope, exclusions, side effects, determinism and resource limits — so an agent has everything needed to call it correctly.

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 coverage is 100%, so baseline would be 3, but the description adds meaningful semantics: colors are alpha-composited over the background before ratio computation, which affects how inputs are interpreted. It does not, however, enumerate accepted color syntaxes beyond the schema examples.

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 a concrete verb and resource — computes the WCAG 2.x contrast ratio between foreground and background colors — and names the exact outputs (AA/AAA pass/fail for normal text, large text, UI components). It explicitly distinguishes itself from the similar sibling color-contrast-fix.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Uses an explicit 'When:' clause (exact color/contrast/palette computation, e.g. accessibility checks) and an explicit 'Not for:' clause routing the closest-color use case to color-contrast-fix. Both inclusion and exclusion are stated with the alternative named.

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