Skip to main content
Glama

scan_page

Identify accessibility violations on web pages by scanning with Axe. Use tags to filter specific WCAG compliance issues and generate detailed reports for remediation.

Instructions

Scan the current page for accessibility violations using Axe

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
violationsTagYesArray of tags to filter violations by. If not specified, all violations are returned.

Implementation Reference

  • The main handler function for the 'scan_page' tool. It uses AxeBuilder to scan the current browser tab for accessibility violations filtered by the provided tags, deduplicates nodes, and streams results to the response including URL summary and detailed violations.
    handle: async (context, params, response) => { const tab = context.currentTabOrDie(); const axe = new AxeBuilder({ page: tab.page }).withTags(params.violationsTag); const results = await axe.analyze(); response.addResult([ `URL: ${results.url}`, '', `Violations: ${results.violations.length}, Incomplete: ${results.incomplete.length}, Passes: ${results.passes.length}, Inapplicable: ${results.inapplicable.length}`, ].join('\n')); results.violations.forEach(violation => { const uniqueNodes = dedupeViolationNodes(violation.nodes); response.addResult([ '', `Tags : ${violation.tags}`, `Violations: ${JSON.stringify(uniqueNodes, null, 2)}`, ].join('\n')); }); },
  • Zod schema defining the input parameters for the 'scan_page' tool, specifically the 'violationsTag' array for filtering Axe violations.
    const scanPageSchema = z.object({ violationsTag: z .array(z.enum(tagValues)) .min(1) .default([...tagValues]) .describe('Array of tags to filter violations by. If not specified, all violations are returned.') });
  • Tool metadata registration within defineTool, specifying name 'scan_page', title, description, input schema reference, and type.
    schema: { name: 'scan_page', title: 'Scan page for accessibility violations', description: 'Scan the current page for accessibility violations using Axe', inputSchema: scanPageSchema, type: 'destructive', },
  • Default export array including the scanPage tool, allowing its registration in the MCP server by importing this module.
    export default [ snapshot, click, drag, hover, selectOption, scanPage ];
  • Helper function used in the handler to deduplicate Axe violation nodes based on their target and HTML content to avoid redundant reporting.
    const dedupeViolationNodes = (nodes: AxeNode[]): AxeNode[] => { const seen = new Set<string>(); return nodes.filter(node => { const key = JSON.stringify({ target: node.target ?? [], html: node.html ?? '' }); if (seen.has(key)) return false; seen.add(key); return true; }); };

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/JustasMonkev/mcp-accessibility-scanner'

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