Skip to main content
Glama

check_wcag_contrast

Read-onlyIdempotent

utilpeek: Check the WCAG contrast between a text color and a background color. To convert colour formats too use convert_color_check_contrast. Returns the WCAG 2.x contrast ratio of a foreground and a background CSS color, with AA / AAA pass or fail for normal text, large text and UI components (unrounded: #777 on white is 4.48:1 and fails AA). An unparseable or out-of-range color is a 422 before any payment (not charged). A translucent color is composited over the background before the contrast is computed. Typically under 0.1 s. Price: USD 0.001. Free: 10 utilpeek calls per IP per UTC day. Docs: https://tanod.dev/learn/color-contrast-checker-api.html

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_wcag_contrast"
  }
}

Input Schema

NameRequiredDescriptionDefault
backgroundYesThe background color it sits on, in the same CSS color formats.
foregroundYesThe text or UI color, a CSS color: hex (#rgb, #rrggbb, #rrggbbaa), rgb() / rgba(), hsl() / hsla(), hwb(), oklch(), oklab(), lab(), lch(), color() (any CSS Color 4 space) or a CSS color name.

Output Schema

NameRequiredDescriptionDefault
noteNo
errorNoOnly on an error result: an object {code, message}, or the reason string of an x402 PaymentRequired object.
ratioNo
backgroundNo
compositedNo
foregroundNo
gamut_noteNo
large_textNo
ratio_textNo
normal_textNo
ui_componentsNo
ratio_unroundedNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / foreground / description
      Previous value: -"The text or UI color, a CSS color: hex (#rgb, #rrggbb, #rrggbbaa), rgb() / rgba(), hsl() / hsla(), oklch(), oklab(), lab(), lch(), color(srgb|display-p3|rec2020) or a CSS color name."New value: +"The text or UI color, a CSS color: hex (#rgb, #rrggbb, #rrggbbaa), rgb() / rgba(), hsl() / hsla(), hwb(), oklch(), oklab(), lab(), lch(), color() (any CSS Color 4 space) or a CSS color name."
  2. Changed2 schema fields changed
    • changedInput schema / properties / foreground / description
      Previous value: -"The text or UI color, a CSS color: hex (#rgb, #rrggbb, #rrggbbaa), rgb() / rgba(), hsl() / hsla() or a CSS color name."New value: +"The text or UI color, a CSS color: hex (#rgb, #rrggbb, #rrggbbaa), rgb() / rgba(), hsl() / hsla(), oklch(), oklab(), lab(), lch(), color(srgb|display-p3|rec2020) or a CSS color name."
    • addedOutput schema / properties / gamut_note
      Added value: +{
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
  3. Changed6 schema fields changed
    • removedInput schema / properties / background / title
      Removed value: -"Background"
    • removedInput schema / properties / foreground / title
      Removed value: -"Foreground"
    • removedInput schema / title
      Removed value: -"check_wcag_contrastArguments"
    • removedOutput schema / properties / large_text / properties
      Removed value: -{
      -  "aa": {
      -    "type": [
      -      "boolean",
      -      "null"
      -    ]
      -  },
      -  "aaa": {
      -    "type": [
      -      "boolean",
      -      "null"
      -    ]
      -  }
      -}
    • removedOutput schema / properties / normal_text / properties
      Removed value: -{
      -  "aa": {
      -    "type": [
      -      "boolean",
      -      "null"
      -    ]
      -  },
      -  "aaa": {
      -    "type": [
      -      "boolean",
      -      "null"
      -    ]
      -  }
      -}
    • removedOutput schema / properties / ui_components / properties
      Removed value: -{
      -  "aa": {
      -    "type": [
      -      "boolean",
      -      "null"
      -    ]
      -  }
      -}
  4. Added

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already cover safety (readOnly, idempotent, non-destructive, closed-world), and the description adds real context beyond them: invalid or out-of-range colors produce a 422 before any charge, translucent colors are composited over the background before computing, results are unrounded (with a worked example), and latency is typically under 0.1s. Pricing and the free-tier quota are also disclosed, though the exact response payload shape is left to the output schema.

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?

Front-loaded with the purpose, followed by the alternative, error/compositing semantics, and a concrete numeric example — all high-value. The closing pricing, free-quota, and docs-URL sentence is dense but operationally relevant, so little is wasted; a slightly tighter phrasing would earn a 5.

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?

For a two-parameter, fully schema-documented, annotation-covered tool with an output schema, this description covers everything an agent needs: what it computes, when to use the sibling instead, error behavior, translucent-input handling, result precision, cost, and latency.

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% and the schema already enumerates accepted CSS color formats in detail. The description still adds meaning beyond the schema: it frames `foreground` as the text/UI color and `background` as what it sits on, and explains that translucent inputs are composited before measurement — behavior an agent could not infer from the parameter definitions.

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 specific verb and resource — compute the WCAG contrast ratio between a foreground text color and a background color — and immediately distinguishes itself from the sibling convert_color_check_contrast, which handles format conversion. An agent can pick between the two without opening either schema.

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?

Explicitly routes the agent: use this tool for WCAG contrast, use convert_color_check_contrast when colour-format conversion is also needed. That is a named alternative plus the condition that selects it, not merely implied usage.

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