run_accessibility_audit
Audit web page accessibility to identify issues and ensure compliance with standards for improved user experience.
Instructions
Run an accessibility audit on the current page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.js:843-874 (handler)The handler function that executes the accessibility audit. It evaluates JavaScript in the browser context to check for common accessibility issues like images without alt text, unlabeled inputs, and missing headings. Returns a formatted text report of the findings.async runAccessibilityAudit() { await this.ensureChromium(); const result = await this.sendCDPCommand('Runtime.evaluate', { expression: ` const results = []; const imagesWithoutAlt = Array.from(document.querySelectorAll('img:not([alt])')).length; if (imagesWithoutAlt > 0) { results.push(\`Found \${imagesWithoutAlt} images without alt text\`); } const inputsWithoutLabels = Array.from(document.querySelectorAll('input:not([aria-label]):not([id])')).length; if (inputsWithoutLabels > 0) { results.push(\`Found \${inputsWithoutLabels} inputs without proper labels\`); } const headings = Array.from(document.querySelectorAll('h1, h2, h3, h4, h5, h6')); if (headings.length === 0) { results.push('No heading structure found on page'); } JSON.stringify(results.length > 0 ? results : ['Basic accessibility checks passed']); `, returnByValue: true }); const auditResults = JSON.parse(result.result?.value || '[]'); return { content: [{ type: 'text', text: `Accessibility Audit Results:\\n${auditResults.join('\\n')}` }], }; }
- index.js:279-286 (schema)The tool schema definition including name, description, and empty input schema (no parameters required). This is part of the tool list returned by ListToolsRequest.{ name: 'run_accessibility_audit', description: 'Run an accessibility audit on the current page', inputSchema: { type: 'object', properties: {}, }, },
- index.js:379-380 (registration)The registration in the CallToolRequest handler switch statement that dispatches calls to the runAccessibilityAudit method.case 'run_accessibility_audit': return await this.runAccessibilityAudit();