Skip to main content
Glama

validate_accessibility_axe

Analyze website accessibility using Axe to identify WCAG compliance issues with zero false positives, helping developers improve web accessibility.

Instructions

Analyze website accessibility using Axe. Free, open-source, finds ~57% of WCAG issues with zero false positives.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes
wcagLevelNoWCAG level (wcag2a, wcag2aa, wcag2aaa, wcag21aa, wcag22aa)

Implementation Reference

  • The core handler function `analyzeAxe` that launches Playwright Chromium, navigates to the URL, injects axe-core library, runs WCAG-tagged accessibility audits, processes violations by impact level, and returns structured results.
    export async function analyzeAxe( url: string, options: AxeOptions = {} ): Promise<AxeResult> { let browser: Browser | null = null; let page: Page | null = null; try { // Launch browser browser = await chromium.launch({ headless: true }); page = await browser.newPage(); // Navigate to page await page.goto(url, { timeout: options.timeout || 60000, waitUntil: 'networkidle' }); // Inject axe-core await page.addScriptTag({ url: 'https://cdnjs.cloudflare.com/ajax/libs/axe-core/4.10.2/axe.min.js', }); // Run axe analysis const wcagLevel = options.wcagLevel || 'wcag2aa'; const results = await page.evaluate((level) => { return (window as any).axe.run({ runOnly: { type: 'tag', values: [level], }, }); }, wcagLevel); await browser.close(); // Count violations by severity const critical = results.violations.filter((v: any) => v.impact === 'critical').length; const serious = results.violations.filter((v: any) => v.impact === 'serious').length; const moderate = results.violations.filter((v: any) => v.impact === 'moderate').length; const minor = results.violations.filter((v: any) => v.impact === 'minor').length; // Format violations const issues: AxeViolation[] = results.violations.map((v: any) => ({ id: v.id, impact: v.impact, description: v.description, helpUrl: v.helpUrl, nodes: v.nodes.length, })); return { tool: 'axe', success: true, url, wcagLevel, violations: results.violations.length, critical, serious, moderate, minor, passes: results.passes.length, incomplete: results.incomplete.length, issues, }; } catch (error) { if (browser) { await browser.close(); } return { tool: 'axe', success: false, url, wcagLevel: options.wcagLevel || 'wcag2aa', violations: 0, critical: 0, serious: 0, moderate: 0, minor: 0, passes: 0, incomplete: 0, issues: [], error: error instanceof Error ? error.message : String(error), }; } }
  • Zod schema for validating input arguments to the validate_accessibility_axe tool: requires a valid URL and optional WCAG level.
    const AxeArgsSchema = z.object({ url: z.string().url(), wcagLevel: z.string().optional(), });
  • index.ts:189-199 (registration)
    Tool registration in the tools list, including name, description, and JSON input schema for MCP ListTools.
    name: 'validate_accessibility_axe', description: 'Analyze website accessibility using Axe. Free, open-source, finds ~57% of WCAG issues with zero false positives.', inputSchema: { type: 'object', properties: { url: { type: 'string' }, wcagLevel: { type: 'string', description: 'WCAG level (wcag2a, wcag2aa, wcag2aaa, wcag21aa, wcag22aa)' }, }, required: ['url'], }, },
  • index.ts:362-368 (registration)
    Dispatch handler in the main switch statement that validates arguments with Zod schema and calls the analyzeAxe implementation.
    case 'validate_accessibility_axe': { const validatedArgs = AxeArgsSchema.parse(args); const result = await analyzeAxe(validatedArgs.url, { wcagLevel: validatedArgs.wcagLevel, }); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }

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/cordlesssteve/webby-mcp'

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