Skip to main content
Glama

check_aria_attributes

Validate ARIA attribute usage in HTML to ensure compliance with accessibility standards, enhancing web accessibility testing with WCAG guidelines.

Instructions

Check if ARIA attributes are used correctly in HTML

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
htmlYesHTML content to test for ARIA attribute usage

Implementation Reference

  • The main handler function for the 'check_aria_attributes' tool. Launches Puppeteer browser, sets the provided HTML content, runs AxePuppeteer with ARIA-specific rules (aria-allowed-attr, aria-hidden-body, etc.), formats and returns violations and passes as JSON text content.
    async checkAriaAttributes(args: any) {
      const { html } = args;
    
      if (!html) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Missing required parameter: html'
        );
      }
    
      let browser;
      try {
        browser = await puppeteer.launch({
          headless: true,
          args: ['--no-sandbox', '--disable-setuid-sandbox']
        });
        const page = await browser.newPage();
        
        await page.setContent(html);
        
        // Run only the ARIA-related rules
        const axe = new AxePuppeteer(page)
          .options({
            runOnly: {
              type: 'rule',
              values: [
                'aria-allowed-attr',
                'aria-hidden-body',
                'aria-required-attr',
                'aria-required-children',
                'aria-required-parent',
                'aria-roles',
                'aria-valid-attr',
                'aria-valid-attr-value'
              ]
            }
          });
        
        const result = await axe.analyze();
        
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                violations: result.violations.map(violation => ({
                  id: violation.id,
                  impact: violation.impact,
                  description: violation.description,
                  help: violation.help,
                  helpUrl: violation.helpUrl,
                  affectedNodes: violation.nodes.map(node => ({
                    html: node.html,
                    target: node.target,
                    failureSummary: node.failureSummary
                  }))
                })),
                passes: result.passes.map(pass => ({
                  id: pass.id,
                  description: pass.description,
                  help: pass.help,
                  nodes: pass.nodes.length
                }))
              }, null, 2),
            },
          ],
        };
      } finally {
        if (browser) {
          await browser.close();
        }
      }
    }
  • Input schema for the tool, requiring a single 'html' string parameter.
    inputSchema: {
      type: 'object',
      properties: {
        html: {
          type: 'string',
          description: 'HTML content to test for ARIA attribute usage',
        }
      },
      required: ['html'],
    },
  • src/index.ts:128-141 (registration)
    Tool registration object in the ListTools response, defining name, description, and input schema.
    {
      name: 'check_aria_attributes',
      description: 'Check if ARIA attributes are used correctly in HTML',
      inputSchema: {
        type: 'object',
        properties: {
          html: {
            type: 'string',
            description: 'HTML content to test for ARIA attribute usage',
          }
        },
        required: ['html'],
      },
    },
  • src/index.ts:170-171 (registration)
    Dispatch case in the CallToolRequest handler that calls the checkAriaAttributes method.
    case 'check_aria_attributes':
      return await this.checkAriaAttributes(request.params.arguments);
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool checks ARIA attribute correctness but does not describe what 'correctly' entails, the output format, error handling, or any performance considerations like rate limits. This leaves significant gaps in understanding the tool's behavior beyond its basic purpose.

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, direct sentence: 'Check if ARIA attributes are used correctly in HTML.' It is front-loaded with the core purpose, avoids redundancy, and uses minimal words to convey essential information, making it highly efficient and easy to parse.

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 lack of annotations and output schema, the description is incomplete for effective tool use. It does not explain what constitutes correct ARIA usage, the format of results, or any behavioral traits like whether it's read-only or has side effects. For a tool with no structured metadata, the description should provide more context to compensate, but it falls short.

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 input schema has 100% description coverage, with the 'html' parameter clearly documented as 'HTML content to test for ARIA attribute usage.' The description adds no additional semantic details beyond this, such as examples of valid HTML or constraints on input size. Given the high schema coverage, a baseline score of 3 is appropriate, as the schema adequately handles parameter documentation.

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: 'Check if ARIA attributes are used correctly in HTML.' It specifies the verb ('check'), resource ('ARIA attributes'), and context ('in HTML'), making the function unambiguous. However, it does not explicitly differentiate from sibling tools like 'test_accessibility' or 'test_html_string', which might have overlapping 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. It lacks any mention of prerequisites, exclusions, or comparisons to sibling tools such as 'check_color_contrast' or 'get_rules', leaving the agent to infer usage context solely from the tool name and description.

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