Skip to main content
Glama

audit_webpage

Analyze webpage accessibility by checking compliance with WCAG standards using axe-core. Identify issues, include HTML snippets, and specify tags like wcag2a or best-practice for targeted audits.

Instructions

Perform an accessibility audit on a webpage

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
includeHtmlNoWhether to include HTML snippets in the results
tagsNoSpecific accessibility tags to check (e.g., wcag2a, wcag2aa, wcag21a, best-practice)
urlYesURL of the webpage to audit

Implementation Reference

  • The handler function for 'audit_webpage' tool. Launches Puppeteer browser, navigates to the provided URL, runs Axe accessibility audit with optional tags, formats violations with node details (optionally including HTML), and returns JSON results.
    async auditWebpage(args) {
      if (!args.url) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'URL is required'
        );
      }
    
      try {
        const browser = await puppeteer.launch({
          headless: 'new',
          args: ['--no-sandbox', '--disable-setuid-sandbox'],
        });
        const page = await browser.newPage();
        
        // Set a reasonable viewport
        await page.setViewport({ width: 1280, height: 800 });
        
        // Navigate to the page
        await page.goto(args.url, { waitUntil: 'networkidle2', timeout: 30000 });
        
        // Run axe on the page
        const axeOptions = {};
        if (args.tags && args.tags.length > 0) {
          axeOptions.runOnly = {
            type: 'tag',
            values: args.tags,
          };
        }
        
        const results = await new AxePuppeteer(page).options(axeOptions).analyze();
        
        // Close the browser
        await browser.close();
        
        // Format the results
        const formattedResults = {
          url: args.url,
          timestamp: new Date().toISOString(),
          violations: results.violations.map(violation => {
            const formattedViolation = {
              id: violation.id,
              impact: violation.impact,
              description: violation.description,
              helpUrl: violation.helpUrl,
              nodes: violation.nodes.map(node => {
                const formattedNode = {
                  impact: node.impact,
                  target: node.target,
                  failureSummary: node.failureSummary,
                };
                
                if (args.includeHtml) {
                  formattedNode.html = node.html;
                }
                
                return formattedNode;
              }),
            };
            
            return formattedViolation;
          }),
          passes: results.passes.length,
          incomplete: results.incomplete.length,
          inapplicable: results.inapplicable.length,
        };
        
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(formattedResults, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error auditing webpage: ${error.message}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Input schema for the 'audit_webpage' tool defining required 'url' and optional 'includeHtml' and 'tags' parameters.
    inputSchema: {
      type: 'object',
      properties: {
        url: {
          type: 'string',
          description: 'URL of the webpage to audit',
        },
        includeHtml: {
          type: 'boolean',
          description: 'Whether to include HTML snippets in the results',
          default: false,
        },
        tags: {
          type: 'array',
          items: {
            type: 'string',
          },
          description: 'Specific accessibility tags to check (e.g., wcag2a, wcag2aa, wcag21a, best-practice)',
        },
      },
      required: ['url'],
    },
  • src/index.js:40-65 (registration)
    Registration of the 'audit_webpage' tool in the ListTools response, including name, description, and input schema.
    {
      name: 'audit_webpage',
      description: 'Perform an accessibility audit on a webpage',
      inputSchema: {
        type: 'object',
        properties: {
          url: {
            type: 'string',
            description: 'URL of the webpage to audit',
          },
          includeHtml: {
            type: 'boolean',
            description: 'Whether to include HTML snippets in the results',
            default: false,
          },
          tags: {
            type: 'array',
            items: {
              type: 'string',
            },
            description: 'Specific accessibility tags to check (e.g., wcag2a, wcag2aa, wcag21a, best-practice)',
          },
        },
        required: ['url'],
      },
    },
  • src/index.js:85-86 (registration)
    Dispatch case in the CallToolRequestSchema handler that routes 'audit_webpage' calls to the auditWebpage method.
    case 'audit_webpage':
      return this.auditWebpage(request.params.arguments);
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 fails to mention critical aspects like whether it requires authentication, has rate limits, returns structured data, or handles errors. This leaves significant gaps in understanding how the tool behaves in practice.

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, clear sentence with no wasted words, making it highly concise and front-loaded. Every part of the sentence directly contributes to understanding the tool's purpose, earning its place effectively.

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?

Given the complexity of an accessibility audit tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the audit returns, how results are formatted, or any behavioral traits, leaving the agent with incomplete information to use the tool effectively in context.

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?

Schema description coverage is 100%, so the input schema already documents all parameters thoroughly. The description doesn't add any additional meaning or context beyond what's in the schema, such as explaining the relationship between parameters or typical use cases. This meets the baseline for high schema coverage.

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 action ('perform an accessibility audit') and the target resource ('on a webpage'), making the purpose immediately understandable. However, it doesn't differentiate from the sibling tool 'get_summary', which might be related but isn't explicitly contrasted, preventing a perfect score.

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, such as the sibling 'get_summary'. It lacks context about prerequisites, scenarios, or exclusions, leaving the agent with minimal usage direction beyond the basic purpose.

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/priyankark/a11y-mcp'

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