Skip to main content
Glama

test_accessibility

Evaluate webpage accessibility compliance with WCAG standards using Axe-core. Analyze specific accessibility tags to identify and address issues effectively.

Instructions

Test a webpage for accessibility issues using Axe-core

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tagsNoOptional array of accessibility tags to test (e.g., "wcag2a", "wcag2aa", "wcag21a")
urlYesURL of the webpage to test

Implementation Reference

  • src/index.ts:46-65 (registration)
    Registration of the 'test_accessibility' tool in the MCP ListTools handler, defining its name, description, and input schema.
    {
      name: 'test_accessibility',
      description: 'Test a webpage for accessibility issues using Axe-core',
      inputSchema: {
        type: 'object',
        properties: {
          url: {
            type: 'string',
            description: 'URL of the webpage to test',
          },
          tags: {
            type: 'array',
            items: { type: 'string' },
            description: 'Optional array of accessibility tags to test (e.g., "wcag2a", "wcag2aa", "wcag21a")',
            default: ['wcag2aa']
          }
        },
        required: ['url'],
      },
    },
  • The main handler function for 'test_accessibility' tool. Launches Puppeteer browser, navigates to the provided URL, runs Axe accessibility analysis (optionally filtered by tags), formats results, and returns as MCP content.
    async testAccessibility(args: any) {
      const { url, tags } = args;
    
      if (!url) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Missing required parameter: url'
        );
      }
    
      let browser;
      try {
        browser = await puppeteer.launch({
          headless: true,
          args: ['--no-sandbox', '--disable-setuid-sandbox']
        });
        const page = await browser.newPage();
        
        // Set a reasonable viewport
        await page.setViewport({ width: 1280, height: 800 });
        
        await page.goto(url, { waitUntil: 'networkidle0', timeout: 0 });
        
        // Run axe analysis
        const axe = new AxePuppeteer(page);
        
        if (tags && tags.length > 0) {
          axe.withTags(tags);
        }
        
        const result = await axe.analyze();
        
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(this.formatResults(result), null, 2),
            },
          ],
        };
      } finally {
        if (browser) {
          await browser.close();
        }
      }
    }
  • Helper function used by the test_accessibility handler to format AxeResults into a structured JSON response with violations, passes, and metadata.
    private formatResults(result: AxeResults) {
      return {
        violations: result.violations.map((violation: Result) => ({
          id: violation.id,
          impact: violation.impact || 'unknown',
          description: violation.description,
          help: violation.help,
          helpUrl: violation.helpUrl,
          affectedNodes: violation.nodes.map((node: NodeResult) => ({
            html: node.html,
            target: node.target,
            failureSummary: node.failureSummary || ''
          }))
        })),
        passes: result.passes.length,
        incomplete: result.incomplete.length,
        inapplicable: result.inapplicable.length,
        timestamp: result.timestamp,
        url: result.url,
        testEngine: {
          name: result.testEngine.name,
          version: result.testEngine.version
        },
        testRunner: result.testRunner,
        testEnvironment: result.testEnvironment,
      };
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool does but doesn't describe how it behaves: no information about execution time, error handling, rate limits, authentication requirements, or what constitutes a successful test. For a tool that performs analysis on external URLs, this is a significant gap.

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?

The description is a single, efficient sentence that states the core functionality without unnecessary words. It's appropriately sized for a tool with two parameters and gets straight to the point.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool that performs accessibility testing on webpages with no annotations and no output schema, the description is insufficient. It doesn't explain what kind of results to expect, how issues are reported, whether the tool performs full-page analysis or sampling, or any limitations of the Axe-core engine. The context signals indicate this is a non-trivial analysis tool that needs more complete documentation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with both parameters well-documented in the schema itself. The description doesn't add any meaningful parameter semantics beyond what's already in the schema - it doesn't explain the relationship between URL and tags, provide examples of tag usage, or clarify testing scope. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Test') and resource ('a webpage for accessibility issues'), and mentions the technology used ('using Axe-core'). However, it doesn't explicitly differentiate from sibling tools like 'check_color_contrast' or 'test_html_string', which appear to be related accessibility testing functions.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'test_html_string' or 'check_color_contrast'. It doesn't mention prerequisites, limitations, or typical use cases beyond the basic functionality.

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

Related 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/ronantakizawa/a11ymcp'

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