Skip to main content
Glama

Scan an HTML snippet

scan_html
Read-onlyIdempotent

Scan raw HTML snippets or component markup for WCAG accessibility issues in-process using jsdom and axe-core, reporting findings with fix operations so you can check code inside a tight edit loop.

Instructions

Scan a raw HTML snippet or component markup without serving it — IN-PROCESS by default (jsdom + WebAbility detectors + axe-core): milliseconds, no browser, no network, so it fits inside a tight edit loop. A snippet is capped at 256 KB, 300 elements and 100 nesting levels, and at 24s per call — past any of those the call is refused with the alternative to use; for a whole page use scan_page. Fragments are auto-wrapped into a document. Returns scan_page's shape (issues / summary) with fix.op + fixability on every finding. jsdom has no layout, so visual-tier rules (contrast, target size, focus ring) are NOT evaluated — the dropped count is reported as skippedVisual; pass engine: "browser" to run the axe-core headless-browser path for those (slower, axe rules only, returns axe violations).

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": {
      "html": "<html>"
    },
    "name": "scan_html"
  }
}

Input Schema

NameRequiredDescriptionDefault
htmlYesHTML content to test — a full document or a fragment
tagsNoWCAG tags to check (default ["wcag2a","wcag2aa","wcag21aa","wcag22aa"])
wcagNoOnly these WCAG criteria. A prefix selects the whole guideline ("1.4") or principle ("2").
levelNoHighest WCAG conformance level to report. Default "AA" — Level AAA criteria are not reported. Pass "AAA" to include them (naming one AAA criterion in `wcag`, e.g. "3.2.5", also includes it).
rulesNoOnly these rule ids (WebAbility type such as "missing_alt" or axe rule id such as "image-alt"). See get_rules.
widthNoViewport width (browser engine only, default 1280)
engineNo"in-process" (default): jsdom, ms, structural rules. "browser": headless Chromium + axe-core, includes contrast.
formatNo"compact" prints one line per element with rule metadata once. "json" returns every field (html, fix values, source). Default: JSON when it fits inline (under ~24k chars), otherwise compact plus a JSON summary of every count. On the hosted server the default is compact.
heightNoViewport height (browser engine only, default 800)
minImpactNoOnly findings at this severity or above (critical > serious > moderate > minor)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.10.2
    • changedInput schema / properties / format / description
      Previous value: -"\"compact\" prints one line per element with rule metadata once. \"json\" returns every field (html, fix values, source). Default: JSON when it fits inline (under ~24k chars), otherwise compact plus a JSON summary of every count."New value: +"\"compact\" prints one line per element with rule metadata once. \"json\" returns every field (html, fix values, source). Default: JSON when it fits inline (under ~24k chars), otherwise compact plus a JSON summary of every count. On the hosted server the default is compact."
  2. Changed1 schema field changedv1.8.0
    • addedInput schema / properties / level
      Added value: +{
      +  "description": "Highest WCAG conformance level to report. Default \"AA\" — Level AAA criteria are not reported. Pass \"AAA\" to include them (naming one AAA criterion in `wcag`, e.g. \"3.2.5\", also includes it).",
      +  "enum": [
      +    "A",
      +    "AA",
      +    "AAA"
      +  ],
      +  "type": "string"
      +}
  3. Changed8 schema fields changedv1.7.0
    • addedInput schema / properties / engine
      Added value: +{
      +  "description": "\"in-process\" (default): jsdom, ms, structural rules. \"browser\": headless Chromium + axe-core, includes contrast.",
      +  "enum": [
      +    "in-process",
      +    "browser"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / format
      Added value: +{
      +  "description": "\"compact\" prints one line per element with rule metadata once. \"json\" returns every field (html, fix values, source). Default: JSON when it fits inline (under ~24k chars), otherwise compact plus a JSON summary of every count.",
      +  "enum": [
      +    "json",
      +    "compact"
      +  ],
      +  "type": "string"
      +}
    • changedInput schema / properties / height / description
      Previous value: -"Viewport height (default 800)"New value: +"Viewport height (browser engine only, default 800)"
    • changedInput schema / properties / html / description
      Previous value: -"HTML content to test"New value: +"HTML content to test — a full document or a fragment"
    • addedInput schema / properties / minImpact
      Added value: +{
      +  "description": "Only findings at this severity or above (critical > serious > moderate > minor)",
      +  "enum": [
      +    "critical",
      +    "serious",
      +    "moderate",
      +    "minor"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / rules
      Added value: +{
      +  "description": "Only these rule ids (WebAbility type such as \"missing_alt\" or axe rule id such as \"image-alt\"). See get_rules.",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • addedInput schema / properties / wcag
      Added value: +{
      +  "description": "Only these WCAG criteria. A prefix selects the whole guideline (\"1.4\") or principle (\"2\").",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • changedInput schema / properties / width / description
      Previous value: -"Viewport width (default 1280)"New value: +"Viewport width (browser engine only, default 1280)"
  4. First observedv1.3.1

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only declare it as a safe read/idempotent/closed-world operation; the description goes well beyond that with resource limits (256 KB, 300 elements, 100 nesting levels, 24s), auto-wrapping of fragments, and exactly what the jsdom path cannot evaluate plus how the gap is surfaced as skippedVisual. It also discloses the behavioral difference of the browser path (slower, axe rules only, axe-shaped violations).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the mode (in-process, milliseconds) before the caveats, and essentially every clause carries operational information. It is a single dense block rather than a broken-up structure, which makes it slightly heavy to parse, but there is little filler to cut.

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?

No output schema exists, yet the description tells the agent the return shape (issues / summary, fix.op + fixability per finding) and the divergence for the browser engine (axe violations). Combined with the documented limits and fallbacks, an agent can invoke this correctly and predict the failure modes.

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 baseline is 3; the description nonetheless adds meaning the schema doesn't carry, notably the engine tradeoff (in-process = structural only, browser = axe-core plus contrast) and the format fallback behavior tied to output size. It doesn't spell out semantics for every parameter (tags, wcag, level, minImpact) beyond what the schema already documents.

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?

Opens with a specific verb+resource ("Scan a raw HTML snippet or component markup") and immediately scopes how ("without serving it — IN-PROCESS by default"). It explicitly distinguishes itself from the sibling scan_page ("for a whole page use scan_page"), so an agent can route without opening either schema.

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

Usage Guidelines5/5

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

Explicit when-to-use (fits a tight edit loop, ms latency, no network) and when-not (whole pages go to scan_page), plus a conditional alternative ("pass engine: \"browser\" ... for those"). Hard caps each carry a stated consequence (call refused) and a pointer to the alternative.

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