Skip to main content
Glama

Check contrast

check_contrast
Read-only

Measure text/background contrast using WCAG 2 and APCA, then get the closest text color that passes your requested AA or AAA level.

Instructions

Measures text/background contrast with WCAG 2 (ratio) and APCA (Lc). If it fails the requested level, suggests the closest text color that passes.

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

Input Schema

NameRequiredDescriptionDefault
textYesText color in hex
levelNoAA
backgroundYesBackground color in hex

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, so safety is covered; the description adds the substantive behavior beyond that: two parallel scoring systems and a remediation step (suggests the closest passing text color on failure). It stops short of saying what the returned payload contains (raw ratios? a pass boolean? the suggested hex?), which matters since there is no 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.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, both load-bearing: the first defines the measurement, the second defines the fallback behavior. Front-loaded with the core verb+resource and zero filler or restatement of the title.

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 3-parameter, read-only calculator with no output schema, the description covers the two metrics produced and the conditional suggestion. The main residual gap is return shape — an agent cannot tell what fields come back or whether pass/fail is included — but that is a modest omission for a tool this simple.

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 coverage is 67%, with text/background documented only as 'hex' and level carrying an enum plus default. The description does add real meaning for level — failure against it triggers a suggested replacement color — and implies text is the adjustable input while background is fixed. However it leaves hex format ambiguous (3/6/8 digits, '#' prefix, case), which the schema also fails to specify.

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?

States a specific verb and resource: 'Measures text/background contrast', and names the two scoring systems (WCAG 2 ratio, APCA Lc), so the agent knows exactly what computation is performed. It does not need to disambiguate from siblings (icon/gradient/font tools are unrelated), but it also doesn't explicitly position itself among them.

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 implied by the metric names and the 'requested level' framing (accessibility auditing), but there is no explicit when-to-use or when-not-to-use statement. No alternatives are named or excluded, which is acceptable here since no sibling tool overlaps, though an explicit 'use before shipping a palette' style cue would raise this.

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