Skip to main content
Glama
nzjami

Playwright MCP

by nzjami

browser_install

Destructive

Install the required browser for Playwright MCP's automation tasks when encountering browser not installed errors.

Instructions

Install the browser specified in the config. Call this if you get an error about the browser not being installed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that forks the Playwright CLI process to install the browser channel specified in the config (defaults to 'chrome'). Captures output and rejects on non-zero exit code.
    handle: async (context, params, response) => {
      const channel = context.config.browser?.launchOptions?.channel ?? context.config.browser?.browserName ?? 'chrome';
      const cliUrl = import.meta.resolve('playwright/package.json');
      const cliPath = path.join(fileURLToPath(cliUrl), '..', 'cli.js');
      const child = fork(cliPath, ['install', channel], {
        stdio: 'pipe',
      });
      const output: string[] = [];
      child.stdout?.on('data', data => output.push(data.toString()));
      child.stderr?.on('data', data => output.push(data.toString()));
      await new Promise<void>((resolve, reject) => {
        child.on('close', code => {
          if (code === 0)
            resolve();
          else
            reject(new Error(`Failed to install browser: ${output.join('')}`));
        });
      });
      response.setIncludeTabs();
    },
  • The tool schema defining name 'browser_install', empty input schema (no parameters), and destructive type.
    schema: {
      name: 'browser_install',
      title: 'Install the browser specified in the config',
      description: 'Install the browser specified in the config. Call this if you get an error about the browser not being installed.',
      inputSchema: z.object({}),
      type: 'destructive',
    },
  • src/tools.ts:36-52 (registration)
    Registers browser_install by spreading the install tools array into the global allTools list used by the backend.
    export const allTools: Tool<any>[] = [
      ...common,
      ...console,
      ...dialogs,
      ...evaluate,
      ...files,
      ...install,
      ...keyboard,
      ...navigate,
      ...network,
      ...mouse,
      ...pdf,
      ...screenshot,
      ...snapshot,
      ...tabs,
      ...wait,
    ];
  • The MCP ServerBackend.tools() method exposes the tool schemas (including browser_install) to the MCP server.
    tools(): mcpServer.ToolSchema<any>[] {
      return this._tools.map(tool => tool.schema);
    }
  • Initializes the backend's _tools list using filteredTools(config), which includes core-install capability tools like browser_install.
    constructor(config: FullConfig, browserContextFactory: BrowserContextFactory) {
      this._tools = filteredTools(config);

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations indicate destructiveHint=true and readOnlyHint=false, which the description aligns with by implying installation (a write operation). The description adds valuable context beyond annotations by specifying it's for resolving installation errors, which helps the agent understand when this destructive action is appropriate.

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

Conciseness5/5

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

The description is two concise sentences that directly address the tool's purpose and usage scenario. Every word serves a clear function, with no redundant or unnecessary information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 0 parameters, no output schema, and annotations cover key behavioral aspects (destructive, not read-only), the description provides sufficient context by explaining what it does and when to use it. It could slightly improve by mentioning what 'config' refers to, but it's adequate for this simple tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, maintaining focus on the tool's purpose and usage context.

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 ('Install') and target ('browser specified in the config'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like browser_click or browser_navigate, which perform different browser operations rather than installation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool: 'Call this if you get an error about the browser not being installed.' This clearly defines the trigger condition and context for usage, with no misleading information.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.