/**
* Prompt: comprehensive-a11y-test
* Predefined template for comprehensive accessibility testing with minimal input
*/
import { z } from 'zod';
export const comprehensiveA11yTestSchema = {
url: z.string().describe('URL to test (e.g., https://example.com)'),
block: z
.string()
.optional()
.describe("Name of specific section/component to test (e.g., 'Rewards account', 'Navigation')"),
steps: z
.string()
.optional()
.describe("Comma-separated interaction steps (e.g., 'open Rewards block, select provider, input value, click apply')")
};
export interface ComprehensiveA11yTestParams {
url: string;
block?: string;
steps?: string;
}
/**
* Generate comprehensive accessibility test instructions
*/
export function generateComprehensiveTestPrompt(params: ComprehensiveA11yTestParams) {
const { url, block, steps } = params;
let instructions = `Use the accessibility-testing MCP tools to perform a comprehensive audit.
**Testing Instructions:**
1. Navigate to the URL: ${url}
2. Run a full accessibility audit using Axe (axe-core).
3. Return:
- A list of all accessibility issues found
- For each issue include: rule ID, description, severity/impact, selector, HTML snippet (if available)
4. Generate a final human-readable summary explaining:
- The main categories of problems
- Which issues are most critical
- What should be fixed first
`;
if (block && steps) {
instructions += `
5. Test the "${block}" section specifically:
- Perform these interactions: ${steps}
- Scan for accessibility issues after each interaction
- Compare violations across different states
**How to execute:**
- First: Use \`mcp__playwright-a11y__a11y_scanUrl\` for the initial full page scan
- Then: Use \`mcp__playwright-a11y__a11y_scanInteractiveByText\` with:
- containerText: "${block}"
- customInteractions: Parse the steps "${steps}" into individual actions
- captureScreenshots: true
`;
} else if (block) {
instructions += `
5. Test the "${block}" section specifically:
- Auto-discover and test all interactive elements
- Scan for accessibility issues in different states
**How to execute:**
- First: Use \`mcp__playwright-a11y__a11y_scanUrl\` for the initial full page scan
- Then: Use \`mcp__playwright-a11y__a11y_scanInteractiveByText\` with:
- containerText: "${block}"
- autoDiscover: true
- captureScreenshots: true
`;
} else {
instructions += `
**How to execute:**
- Use \`mcp__playwright-a11y__a11y_scanUrl\` with:
- url: "${url}"
- captureScreenshot: true
- timeout: 30000
`;
}
instructions += `
**Report Format:**
After completing all scans, provide:
1. Executive Summary (severity counts, main issues)
2. Critical Issues (impact: "critical" or "serious")
3. Moderate Issues (impact: "moderate")
4. Minor Issues (impact: "minor")
5. Recommendations (prioritized fix list)
Make the report actionable and easy to understand for developers.`;
return {
messages: [
{
role: 'user' as const,
content: {
type: 'text' as const,
text: instructions
}
}
]
};
}