Skip to main content
Glama
aimsise

color-engine

by aimsise

contrast

Read-onlyIdempotent

Compute WCAG 2.1 contrast ratio between two CSS colors and return AA/AAA tier flags (normal/large text). Optionally also compute APCA-W3 Lc.

Instructions

Compute the WCAG 2.1 contrast ratio between two fully opaque CSS color strings and return WCAG tier flags (AA/AAA normal/large text). Set apca:true to also get the signed APCA-W3 Lc for text a over background b.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYesFirst CSS color string, e.g. "#000000", "black", "oklch(0 0 0)" (max 256 chars)
bYesSecond CSS color string, e.g. "#ffffff", "white", "oklch(1 0 0)" (max 256 chars)
apcaNoWhen true, additionally compute the APCA-W3 (SAPC-4g) lightness contrast Lc for text `a` over background `b` (returned as `apcaLc`)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
ratioYes2-decimal display value; tier flags derive from the unrounded raw ratio
apcaLcNoSigned APCA-W3 (SAPC-4g) Lc for text `a` over background `b`, rounded to 2 decimals (positive = dark-on-light, negative = light-on-dark); present only when input `apca` is true
aaLargeYesMeets WCAG 2.1 AA for large text (raw ratio >= 3)
aaNormalYesMeets WCAG 2.1 AA for normal text (raw ratio >= 4.5)
aaaLargeYesMeets WCAG 2.1 AAA for large text (raw ratio >= 4.5)
aaaNormalYesMeets WCAG 2.1 AAA for normal text (raw ratio >= 7)
Behavior4/5

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

Annotations already indicate read-only, idempotent, and non-destructive behavior. The description adds context about the 'fully opaque' requirement and order sensitivity (text 'a' over background 'b'), which is useful and not contradicted by annotations.

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 concise sentences, front-loaded with the primary function and immediately followed by the optional modifier. Every word earns its place with no redundant details.

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?

The tool is simple (3 params, all documented) and has an output schema. The description covers the core behavior, optional flag, and input constraints. It is fully complete for an agent to invoke correctly.

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 parameters are already documented. The description enhances this by clarifying the directional relationship ('text `a` over background `b`') and the meaning of the optional `apca` flag, which goes beyond the schema descriptions.

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 clearly states it computes the WCAG 2.1 contrast ratio between two CSS colors and returns WCAG tier flags. It also mentions the optional APCA computation, which distinguishes it from siblings like parse_color or solve_for_contrast.

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?

The description provides clear context: it computes contrast between a text color and background color, with optional APCA. It doesn't explicitly exclude alternatives like solve_for_contrast, but the purpose is unambiguous and an agent can infer when to use it. No exclusions or alternative mentions are given.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aimsise/color-engine-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server