Skip to main content
Glama

validate_accessibility_wave

Test website accessibility for WCAG compliance, identify errors, and detect contrast issues using WAVE analysis to ensure inclusive web experiences.

Instructions

Analyze website accessibility using WAVE. Tests WCAG compliance, errors, and contrast issues. Requires API key.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes
apiKeyYesWAVE API key (required)
reporttypeNoDetail level (1-4)

Implementation Reference

  • The core handler function that performs the WAVE accessibility validation by calling the WAVE API, parsing the response, and returning structured results with error counts, contrast issues, alerts, and raw data.
    export async function analyzeWAVE(
      url: string,
      options: WAVEOptions
    ): Promise<WAVEResult> {
      try {
        if (!options.apiKey) {
          throw new Error('WAVE API key is required. Get one at https://wave.webaim.org/api/');
        }
    
        // Build API URL
        const params = new URLSearchParams({
          key: options.apiKey,
          url,
        });
    
        if (options.reporttype) {
          params.set('reporttype', options.reporttype.toString());
        }
    
        if (options.viewportwidth) {
          params.set('viewportwidth', options.viewportwidth.toString());
        }
    
        const apiUrl = `https://wave.webaim.org/api/request?${params.toString()}`;
    
        const response = await fetch(apiUrl);
    
        if (!response.ok) {
          throw new Error(`WAVE API error: ${response.status} ${response.statusText}`);
        }
    
        const data: WAVEResponse = await response.json();
    
        if (!data.status.success) {
          throw new Error(`WAVE analysis failed with HTTP status: ${data.status.httpstatuscode}`);
        }
    
        return {
          tool: 'wave',
          success: true,
          url,
          errors: data.categories.error.count,
          contrast_errors: data.categories.contrast.count,
          alerts: data.categories.alert.count,
          total_issues: data.categories.error.count + data.categories.contrast.count + data.categories.alert.count,
          wave_report_url: data.statistics.waveurl,
          credits_remaining: data.statistics.creditsremaining,
          raw: data,
        };
      } catch (error) {
        return {
          tool: 'wave',
          success: false,
          url,
          errors: 0,
          contrast_errors: 0,
          alerts: 0,
          total_issues: 0,
          error: error instanceof Error ? error.message : String(error),
        };
      }
    }
  • Zod schema used to validate the input arguments for the validate_accessibility_wave tool.
    const WAVEArgsSchema = z.object({
      url: z.string().url(),
      apiKey: z.string(),
      reporttype: z.union([z.literal(1), z.literal(2), z.literal(3), z.literal(4)]).optional(),
    });
  • index.ts:176-187 (registration)
    Tool registration definition including name, description, and input schema for the MCP server.
      name: 'validate_accessibility_wave',
      description: 'Analyze website accessibility using WAVE. Tests WCAG compliance, errors, and contrast issues. Requires API key.',
      inputSchema: {
        type: 'object',
        properties: {
          url: { type: 'string' },
          apiKey: { type: 'string', description: 'WAVE API key (required)' },
          reporttype: { type: 'number', enum: [1, 2, 3, 4], description: 'Detail level (1-4)' },
        },
        required: ['url', 'apiKey'],
      },
    },
  • Dispatch handler in the main CallToolRequestSchema that validates args and calls the analyzeWAVE function.
    case 'validate_accessibility_wave': {
      const validatedArgs = WAVEArgsSchema.parse(args);
      const result = await analyzeWAVE(validatedArgs.url, {
        apiKey: validatedArgs.apiKey,
        reporttype: validatedArgs.reporttype,
      });
      return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
    }
  • TypeScript interfaces defining options, API response, and result structure for the WAVE tool.
    export interface WAVEOptions {
      /** API key (required - get from https://wave.webaim.org/api/) */
      apiKey: string;
      /** Report type: 1=summary, 2=detailed, 3=very detailed, 4=all (default: 2) */
      reporttype?: 1 | 2 | 3 | 4;
      /** Viewport width for testing (default: 1024) */
      viewportwidth?: number;
    }
    
    export interface WAVEResponse {
      status: {
        success: boolean;
        httpstatuscode: number;
      };
      statistics: {
        pagetitle: string;
        pageurl: string;
        time: number;
        creditsremaining: number;
        allitemcount: number;
        totalelements: number;
        waveurl: string;
      };
      categories: {
        error: {
          description: string;
          count: number;
          items: Record<string, any>;
        };
        contrast: {
          description: string;
          count: number;
          items: Record<string, any>;
        };
        alert: {
          description: string;
          count: number;
          items: Record<string, any>;
        };
      };
    }
    
    export interface WAVEResult {
      tool: 'wave';
      success: boolean;
      url: string;
      errors: number;
      contrast_errors: number;
      alerts: number;
      total_issues: number;
      wave_report_url?: string;
      credits_remaining?: number;
      error?: string;
      raw?: WAVEResponse;
    }
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 mentions the requirement for an API key, which is useful context, but lacks details on rate limits, authentication needs beyond the key, error handling, or what the analysis entails (e.g., is it a one-time scan or continuous?). For a tool with no annotations, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded: two sentences that directly state the purpose and a key requirement. Every sentence adds value—the first explains what the tool does, and the second notes the API key need. It could be slightly more structured by explicitly listing parameters, but it avoids unnecessary details.

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 (accessibility analysis tool with 3 parameters, no annotations, and no output schema), the description is incomplete. It lacks details on output format, error cases, performance implications, or how it differs from sibling tools. Without annotations or output schema, the description should provide more context to be fully helpful for an AI agent.

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 67% (2 out of 3 parameters have descriptions). The description adds minimal param semantics: it implies the tool tests 'WCAG compliance, errors, and contrast issues' which relates to the 'url' parameter, but doesn't explain the 'reporttype' enum values (1-4) or provide additional context beyond the schema. With moderate schema coverage, the baseline is 3 as the description doesn't significantly compensate for gaps.

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: 'Analyze website accessibility using WAVE. Tests WCAG compliance, errors, and contrast issues.' It specifies the verb ('analyze'), resource ('website accessibility'), and method ('using WAVE'), distinguishing it from siblings like 'validate_accessibility_axe' which uses a different tool. However, it doesn't explicitly differentiate from 'validate_all_accessibility' which might also cover accessibility.

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 minimal usage guidance: it mentions 'Requires API key' as a prerequisite, but offers no explicit guidance on when to use this tool versus alternatives like 'validate_accessibility_axe' or 'validate_all_accessibility'. There's no mention of specific scenarios, limitations, or comparisons with sibling tools.

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

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/cordlesssteve/webby-mcp'

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