Skip to main content
Glama
ashios15

MCP Frontend Tools Server

by ashios15

axe-core Accessibility Audit

axe_audit

Run axe-core accessibility audits on HTML strings or live URLs. Returns violations grouped by impact with fix guidance and help links.

Instructions

Run the axe-core accessibility ruleset against an HTML string (jsdom) or a live URL (Playwright). Returns violations grouped by impact with fix guidance and helpUrl links.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlNoFully qualified URL to audit. Requires playwright installed.
htmlNoRaw HTML string to audit (jsdom, no JS execution).
tagsNoaxe rule tags to include. Defaults to ['wcag2a','wcag2aa','wcag21a','wcag21aa','wcag22aa','best-practice'].
selectorNoCSS selector to scope the audit (URL mode only).
timeoutMsNoDefault 15000.

Implementation Reference

  • src/index.ts:24-25 (registration)
    Registration of the axe_audit tool in the main server setup. The function 'registerAxeAudit' is called with the MCP server instance.
    registerAxeAudit(server);
    registerPageScreenshot(server);
  • Input schema for the axe_audit tool defined using Zod: url (optional), html (optional), tags (optional array of strings), selector (optional), timeoutMs (optional positive int).
    const InputShape = {
      url: z
        .string()
        .url()
        .optional()
        .describe("Fully qualified URL to audit. Requires playwright installed."),
      html: z
        .string()
        .optional()
        .describe("Raw HTML string to audit (jsdom, no JS execution)."),
      tags: z
        .array(z.string())
        .optional()
        .describe(
          "axe rule tags to include. Defaults to ['wcag2a','wcag2aa','wcag21a','wcag21aa','wcag22aa','best-practice']."
        ),
      selector: z
        .string()
        .optional()
        .describe("CSS selector to scope the audit (URL mode only)."),
      timeoutMs: z.number().int().positive().optional().describe("Default 15000."),
    };
  • Main registration & handler for the 'axe_audit' tool. Registers the tool with title, description, inputSchema, and the async handler function that dispatches to auditUrl or auditHtml based on input, returning summarized results.
    export function registerAxeAudit(server: McpServer) {
      server.registerTool(
        "axe_audit",
        {
          title: "axe-core Accessibility Audit",
          description:
            "Run the axe-core accessibility ruleset against an HTML string (jsdom) or a live URL (Playwright). Returns violations grouped by impact with fix guidance and helpUrl links.",
          inputSchema: InputShape,
        },
        async (args) => {
          const tags = args.tags && args.tags.length ? args.tags : DEFAULT_TAGS;
          const timeoutMs = args.timeoutMs ?? 15000;
          if (!args.url && !args.html) {
            return errorResult("Provide either `url` or `html`.");
          }
          try {
            if (args.url) {
              const res = await auditUrl(args.url, tags, args.selector, timeoutMs);
              return jsonResult(summarize(res, "url", args.url));
            }
            const res = await auditHtml(args.html!, tags);
            return jsonResult(summarize(res, "html", `<${args.html!.length} chars>`));
          } catch (err) {
            return errorResult(err instanceof Error ? err.message : String(err));
          }
        }
      );
    }
  • TypeScript interfaces (AxeViolation, AxeResults) defining the shape of axe-core audit results.
    interface AxeViolation {
      id: string;
      impact?: string | null;
      help: string;
      helpUrl: string;
      tags: string[];
      nodes: Array<{
        target: string[];
        html: string;
        failureSummary?: string;
      }>;
    }
    
    interface AxeResults {
      violations: AxeViolation[];
      passes: Array<{ id: string }>;
      incomplete: AxeViolation[];
      url?: string;
      timestamp: string;
    }
  • Helper to summarize axe-core results: counts of violations by impact, passes, incomplete, and truncated violation details with up to 5 nodes each.
    function summarize(results: AxeResults, mode: "url" | "html", target: string) {
      const byImpact: Record<string, number> = {
        critical: 0,
        serious: 0,
        moderate: 0,
        minor: 0,
        unknown: 0,
      };
      for (const v of results.violations) {
        const k = v.impact ?? "unknown";
        byImpact[k] = (byImpact[k] ?? 0) + 1;
      }
      const totalNodes = results.violations.reduce((n, v) => n + v.nodes.length, 0);
      return {
        mode,
        target,
        summary: {
          violationRules: results.violations.length,
          violatingNodes: totalNodes,
          passedRules: results.passes.length,
          incompleteRules: results.incomplete.length,
          byImpact,
        },
        violations: results.violations.map((v) => ({
          id: v.id,
          impact: v.impact ?? null,
          help: v.help,
          helpUrl: v.helpUrl,
          tags: v.tags,
          nodes: v.nodes.slice(0, 5).map((n) => ({
            target: n.target,
            html: n.html.slice(0, 400),
            failureSummary: n.failureSummary,
          })),
          nodeCount: v.nodes.length,
        })),
        incomplete: results.incomplete.map((v) => ({
          id: v.id,
          help: v.help,
          nodeCount: v.nodes.length,
        })),
      };
    }
Behavior4/5

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

No annotations provided, so description carries full burden. It discloses the audit scope (axe-core), return format (grouped violations with guidance/links), and that URL mode uses Playwright. No contradictions.

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 sentences, no fluff. First sentence states core action and modes, second describes output format. Information density is high.

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, but description sufficiently hints at return structure (violations grouped by impact, fix guidance, helpUrl). Parameters well described, tool behavior clear. Complete for the complexity level.

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 has 100% description coverage. Description adds context beyond schema: clarifies dual mode (url/html), defaults for tags, selector only for URL, timeout default. Adds value.

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?

Description clearly states the tool runs axe-core accessibility rules on HTML or URL, returns violations grouped by impact with fix guidance and helpUrl links. This is specific and distinguishes it from sibling tools like screenshot or bundler checks.

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?

Description explains two usage modes (HTML string vs live URL) and mentions prerequisite (playwright for URL). Does not explicitly state when not to use or alternatives, but context with siblings makes it clear.

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/ashios15/mcp-frontend-tools'

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