browser_install
Resolve browser installation errors by installing the browser specified in the configuration file. Use this tool to ensure Playwright MCP server has the required browser for web automation tasks.
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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/install.ts:35-58 (handler)The async handler function that forks the Playwright CLI process to install the browser for the specified channel (default 'chrome'), captures output, and returns a success message.handle: async context => { 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('')}`)); }); }); return { code: [`// Browser ${channel} installed`], captureSnapshot: false, waitForNetwork: false, }; },
- src/tools/install.ts:27-33 (schema)Schema definition for the 'browser_install' tool, specifying name, title, description, empty input schema, 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/install.ts:61-63 (registration)Exports the 'install' tool (which defines 'browser_install') as the default export for registration in the MCP tools system.export default [ install, ];