browser_install
Install the required browser as specified in the configuration. Use this tool to resolve errors related to missing browser installations during Playwright 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:34-53 (handler)The handler function that forks the Playwright CLI to install the browser for the specified channel (default 'chrome') and handles output/errors.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(); },
- src/tools/install.ts:26-32 (schema)Schema definition for the 'browser_install' tool, with 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.ts:36-52 (registration)Registers the browser_install tool by spreading the install module into the allTools array, which is filtered and used by the BrowserServerBackend.export const allTools: Tool<any>[] = [ ...common, ...console, ...dialogs, ...evaluate, ...files, ...install, ...keyboard, ...navigate, ...network, ...mouse, ...pdf, ...screenshot, ...snapshot, ...tabs, ...wait, ];
- src/tools.ts:22-22 (registration)Imports the install module containing the browser_install tool.import install from './tools/install.js';
- src/browserServerBackend.ts:48-50 (registration)The tools() method of BrowserServerBackend exposes tool schemas, including browser_install, to the MCP server.tools(): mcpServer.ToolSchema<any>[] { return this._tools.map(tool => tool.schema); }