Skip to main content
Glama

validate_accessibility_wave

Test website accessibility compliance by analyzing WCAG standards, identifying errors, and detecting contrast issues using WAVE evaluation tool.

Instructions

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

Input Schema

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

Implementation Reference

  • Core handler function that implements the validate_accessibility_wave tool logic by querying the WAVE API, parsing results, and returning accessibility metrics (errors, contrast issues, alerts).
    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), }; } }
  • index.ts:175-187 (registration)
    Registration of the tool in the MCP tools array, defining its name, description, and input schema for the Model Context Protocol 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'], }, },
  • Zod schema used for input validation of tool arguments in the dispatch handler.
    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(), });
  • Dispatch handler case in the main tool router that validates inputs and invokes the analyzeWAVE core handler.
    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) }] }; }

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