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`,
      );
    }
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 starts a scan but doesn't describe what the scan entails (e.g., duration, asynchronous nature, permissions required, rate limits, or what 'start' implies in terms of immediate results). This is a significant gap for a tool that likely initiates a process.

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 a single, efficient sentence that directly states the tool's purpose. It's front-loaded and wastes no words, though it could be slightly more structured if it included key behavioral 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 of starting a scan (likely an asynchronous operation) with no annotations and no output schema, the description is incomplete. It doesn't explain what happens after starting the scan, expected outputs, error handling, or how to retrieve results, leaving critical gaps for agent usage.

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 100%, with clear descriptions for both parameters ('name' and 'pageURL'). The description mentions 'a list of URLs' but the schema only has one 'pageURL' parameter, which adds minor confusion. However, since the schema already documents parameters well, the baseline score of 3 is appropriate as the description doesn't add meaningful semantic details beyond the schema.

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 action ('start an accessibility scan') and the target ('for a list of URLs on BrowserStack'), providing a specific verb+resource combination. However, it doesn't explicitly distinguish this tool from sibling tools like 'runTestsOnBrowserStack' or 'runBrowserLiveSession', which might also involve scanning or testing URLs, so it misses full sibling differentiation.

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 doesn't mention prerequisites, when-not-to-use scenarios, or compare it to sibling tools like 'getFailuresInLastRun' or 'runTestsOnBrowserStack', leaving the agent without context for selection.

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

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