Skip to main content
Glama

对比度审计

browser_contrast_audit
Read-onlyIdempotent

Audit WCAG text contrast on the current page, compute foreground/background ratios, and flag AA/AAA violations with CSS selectors to find unreadable text before shipping.

Instructions

Audit WCAG text contrast on the current page. Reads computed foreground/background colors of visible text elements (compositing alpha over ancestors), computes contrast ratio and flags AA (4.5:1 / 3:1 large) or AAA (7:1 / 4.5:1 large) violations with a CSS selector and text snippet. Use this to find unreadable text before shipping. Returns isError when violations exist unless failOnViolation:false.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "browser_contrast_audit"
  }
}

Input Schema

NameRequiredDescriptionDefault
levelNoWCAG conformance level (default AA)
tabIdNoTab id (default: active tab)
maxResultsNoMax violations to report (1–200, default 50)
failOnViolationNoReturn isError when violations exist (default true)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.15.0

TDQS

A4.7/5.0
Behavior5/5

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

Goes well beyond the annotations by describing the mechanism (computed fg/bg colors, alpha composited over ancestors), the reporting payload (selector plus text snippet), and the critical non-obvious behavior that the call returns isError when violations exist unless failOnViolation is false. The annotations (readOnly, idempotent, non-destructive) are consistent with the 'reads computed colors' framing.

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?

Three dense sentences, each doing distinct work: what it audits, how it computes and reports, and the error semantics. The purpose and the caveat are both front-loaded with no filler.

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, and the description compensates by specifying the violation record contents (CSS selector, text snippet) and the error-return behavior. Everything needed to call this correctly and interpret the result is present.

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 already 100%, so baseline is 3; the description adds real meaning by enumerating the threshold values behind each level (AA 4.5:1 / 3:1 large, AAA 7:1 / 4.5:1 large), which the enum alone does not convey. It also restates the failOnViolation contract in behavioral terms.

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 specific verb and resource ('Audit WCAG text contrast on the current page') and immediately scopes the work to visible text elements, so an agent can distinguish this from generic tools like browser_evaluate or browser_page_state without opening the 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 this to find unreadable text before shipping' gives clear intended usage and timing. It does not name a when-not condition or point at an alternative (e.g., use browser_evaluate for custom checks), so it falls short of explicit routing.

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