Skip to main content
Glama

Find the nearest accessible color that passes contrast

swatch_fix_contrast
Read-onlyIdempotent

Use when a color pair fails contrast and the user wants the smallest change that makes it pass, such as "make this gray text accessible without changing the look". Returns the closest text color on that background that reaches the target (AA, AAA, AA-large or ui), and separately the closest background, keeping the hue. Example: {"foreground": "#777777", "background": "#ffffff", "target": "AA"}. Returns already_passes if nothing needs to change.

Input Schema

NameRequiredDescriptionDefault
targetNoContrast target. Default AA.
backgroundYesCurrent background color.
foregroundYesCurrent text color.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.3/5.0
Behavior4/5

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

The annotations already establish that this is a read-only, idempotent, non-destructive operation, so the description focuses appropriately on behavior beyond safety. It adds useful return context: the closest text color on the background, separately the closest background while keeping hue, and an already_passes outcome when no change is needed.

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?

The description is front-loaded with the usage condition, then explains the return behavior, provides a compact example, and notes the already_passes case. Every sentence contributes to selecting or correctly invoking the tool.

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?

There is no output schema, but the description sufficiently explains what the tool returns and how the already_passes case works. Combined with full parameter documentation in the schema and the safety annotations, an agent has enough information to invoke it correctly.

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 description coverage is 100%, so the schema already documents the three parameters and the target enum. The description reinforces this with an example and mentions target values, but it does not add syntax or semantic detail beyond what the schema provides.

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?

The description states a specific verb and resource: find the closest accessible text or background color that passes a contrast target. It also distinguishes the scenario from mere checking by saying it is for when a color pair fails contrast and the user wants the smallest change that makes it pass.

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?

It gives a clear triggering condition: use when a color pair fails contrast and the user wants the smallest change that makes it pass. However, it does not explicitly name alternatives such as swatch_check_contrast or swatch_pick_text_color, nor does it state when not to use this tool.

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