Skip to main content
Glama

fix_contrast

Read-onlyIdempotent

Adjusts a foreground or background color to meet a WCAG 2.x or APCA contrast target while preserving hue, eliminating trial-and-error color selection.

Instructions

Automatically find the perceptually closest color that meets a WCAG 2.x or APCA contrast target while preserving hue in HCT space. Eliminates trial-and-error guessing.

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": {
      "background": "<background>",
      "foreground": "<foreground>"
    },
    "name": "fix_contrast"
  }
}

Input Schema

NameRequiredDescriptionDefault
adjustNoWhich color to adjust: 'foreground' (default), 'background', or 'auto' (whichever needs smaller ΔE2000)foreground
preferNoDirection preference for tone adjustmentminimal
targetNoContrast target: 'aa' (4.5:1), 'aaa' (7:1), 'aa-large' (3:1), 'ui' (3:1), 'apca-body' (|Lc|≥75), 'apca-content' (|Lc|≥60), 'apca-large' (|Lc|≥45)aa
backgroundYesBackground color
foregroundYesForeground/text color

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.0.0

TDQS

A3.7/5.0
Behavior4/5

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

Annotations already cover the safety profile (readOnly, idempotent, non-destructive), and the description adds genuinely useful behavior beyond them: hue is preserved in HCT space and the result is the perceptually closest compliant color. It stops short of saying what happens when the pair already passes (no-op vs. still returns adjusted values), which is the main remaining ambiguity.

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 tight sentences with the core action front-loaded and no filler. Every clause contributes either scope, constraint, or motivation.

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?

With no output schema, the description should clarify what comes back — only the adjusted color, both colors, or a report of the achieved ratio/ΔE. For a five-parameter tool with rich enum semantics, that return-value gap is the notable omission; everything else an agent needs is present.

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 100% and the enums document their own thresholds (4.5:1, 7:1, Lc≥75, etc.), so the schema carries the parameter load. The description only indirectly contextualizes 'prefer' and 'adjust' via the 'perceptually closest' and hue-preservation framing; it adds no format details for the color strings.

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 outcome: find the perceptually closest color meeting a WCAG 2.x or APCA target while preserving hue. This clearly differentiates it from a pure checker like check_contrast, though it never names that sibling explicitly.

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 'eliminates trial-and-error guessing' — you call this when a contrast check fails and you need a fix rather than a verdict. There is no explicit when-to-use/when-not-to-use statement or named alternative such as check_contrast for merely verifying compliance.

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