Skip to main content
Glama
browserstack

BrowserStack MCP server

Official

startAccessibilityScan

Initiate an accessibility scan for specified URLs to identify and address web accessibility issues using BrowserStack's MCP server.

Instructions

Use this tool to start an accessibility scan for a list of URLs on BrowserStack.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the accessibility scan
pageURLYesThe URL to scan for accessibility issues

Implementation Reference

  • Handler wrapper for startAccessibilityScan tool: handles tracking, executes the core scan logic, and error handling.
    async function executeAccessibilityScan( args: { name: string; pageURL: string; authConfigId?: number }, context: ScanProgressContext, server: McpServer, config: BrowserStackConfig, ): Promise<CallToolResult> { try { trackMCP( "startAccessibilityScan", server.server.getClientVersion()!, undefined, config, ); return await runAccessibilityScan( args.name, args.pageURL, context, config, args.authConfigId, ); } catch (error) { return handleMCPError("startAccessibilityScan", server, config, error); } }
  • Core handler function that performs the accessibility scan: starts scan on BrowserStack, waits for completion, fetches and parses the report.
    async function runAccessibilityScan( name: string, pageURL: string, context: ScanProgressContext, config: BrowserStackConfig, authConfigId?: number, ): Promise<CallToolResult> { const scanner = await initializeScanner(config); const startResp = await scanner.startScan(name, [pageURL], authConfigId); const scanId = startResp.data!.id; const scanRunId = startResp.data!.scanRunId; await notifyScanProgress(context, `Accessibility scan "${name}" started`, 0); const status = await scanner.waitUntilComplete(scanId, scanRunId, context); if (status !== "completed") { return createScanFailureResponse(name, status); } const reportFetcher = await initializeReportFetcher(config); const reportLink = await reportFetcher.getReportLink(scanId, scanRunId); const { records, page_length, total_issues, next_page } = await parseAccessibilityReportFromCSV(reportLink); return createScanSuccessResponse( name, total_issues, page_length, records, scanId, scanRunId, reportLink, next_page, ); }
  • Registers the startAccessibilityScan tool on the MCP server with schema and handler.
    tools.startAccessibilityScan = server.tool( "startAccessibilityScan", "Start an accessibility scan via BrowserStack and retrieve a local CSV report path.", { name: z.string().describe("Name of the accessibility scan"), pageURL: z.string().describe("The URL to scan for accessibility issues"), authConfigId: z .number() .optional() .describe("Optional auth config ID for authenticated scans"), }, async (args, context) => { return await executeAccessibilityScan(args, context, server, config); }, );
  • Input schema for startAccessibilityScan tool using Zod validation.
    name: z.string().describe("Name of the accessibility scan"), pageURL: z.string().describe("The URL to scan for accessibility issues"), authConfigId: z .number() .optional() .describe("Optional auth config ID for authenticated scans"), },
  • Helper function for standardized error handling in MCP tools, used by startAccessibilityScan.
    toolName: string, server: McpServer, config: BrowserStackConfig, error: unknown, ): CallToolResult { trackMCP(toolName, server.server.getClientVersion()!, error, config); const errorMessage = error instanceof Error ? error.message : "Unknown error"; return createErrorResponse( `Failed to ${toolName.replace(/([A-Z])/g, " $1").toLowerCase()}: ${errorMessage}. Please open an issue on GitHub if the problem persists`, ); }

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/browserstack/mcp-server'

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