Skip to main content
Glama

Check contrast

kaava_check_contrast
Read-only

Check a foreground/background color pair against WCAG 2.2 and APCA Lc; when it fails, return the nearest passing same-hue color and valid system text colors.

Instructions

Check one foreground/background pair against WCAG 2.2 and report the APCA Lc value. Each color is a CSS color ("#767676", "rgb(0 0 0 / 0.6)") or a token of the current design system ("color.fg-muted", "--color-primary", "palette.neutral.400"). When the pair fails, returns the nearest passing color of the same hue and the system text colors that do pass on that background. Use it before introducing a pairing the system does not already promise. Works without a kaava.json when both colors are CSS colors.

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": "kaava_check_contrast"
  }
}

Input Schema

NameRequiredDescriptionDefault
useNoWhat the foreground is: "text" (default), "large-text" (24px, or 18.66px bold, and up), or "ui" (icons, borders, focus rings).
modeNoTheme used to resolve semantic color tokens. Default light.
levelNoConformance level to test against. Default AA.
backgroundYesThe color behind it: a CSS color or a token.
foregroundYesText, icon or border color: a CSS color or a token.
projectRootNoAbsolute path of the project. Defaults to the first workspace root the client exposes, else the server working directory.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

Annotations only declare readOnlyHint=true and openWorldHint=false; the description adds substantial behavior beyond that: the failure path returns the nearest passing color of the same hue plus the system text colors that pass, and it discloses the dependency that token inputs require a kaava.json while pure CSS colors do not. Those are exactly the operational facts an agent needs before calling.

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?

Four sentences, each carrying new information: purpose first, accepted input formats second, failure behavior third, usage trigger and the no-config caveat last. No restatement of the name or title and no filler.

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?

With six parameters and no output schema, the description does the heavy lifting on return values (Lc value, nearest passing alternative, passing system colors). It leaves the exact pass/fail result shape (e.g. whether a contrast ratio is also returned) unstated, which is a minor gap for a tool with no output schema.

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 the baseline is 3, but the description adds real meaning by enumerating accepted color syntaxes ("#767676", "rgb(0 0 0 / 0.6)", "color.fg-muted", "--color-primary", "palette.neutral.400") rather than just saying "a CSS color or a token". It also implicitly explains projectRoot's role via the kaava.json note.

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 precise verb and resource: check one foreground/background pair against WCAG 2.2 and report the APCA Lc value. This is clearly a single-pair contrast check, distinguishable from sibling tools like kaava_audit (bulk) and kaava_get_tokens without opening any schema.

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

Usage Guidelines4/5

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

"Use it before introducing a pairing the system does not already promise" gives a concrete trigger for when to call it, which is more than most definitions offer. It stops short of naming an exclusion or an alternative (e.g. auditing an entire system), so an agent must infer that boundary.

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