browser_install
Resolve browser installation errors by installing the browser specified in the configuration. Essential for ensuring Playwright MCP's browser automation functions correctly.
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 handler function that executes the browser installation by forking the Playwright CLI process for the specified browser channel.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)The schema definition for the browser_install tool, specifying name, title, description, 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)Registration of the browser_install tool by spreading the install tools array into snapshotTools.export const snapshotTools: Tool<any>[] = [ ...common(true), ...console, ...dialogs(true), ...files(true), ...install, ...keyboard(true), ...navigate(true), ...network, ...pdf, ...screenshot, ...snapshot, ...tabs(true), ...testing, ...video, ...wait(true), ];
- src/tools.ts:54-69 (registration)Registration of the browser_install tool by spreading the install tools array into visionTools.export const visionTools: Tool<any>[] = [ ...common(false), ...console, ...dialogs(false), ...files(false), ...install, ...keyboard(false), ...navigate(false), ...network, ...pdf, ...tabs(false), ...testing, ...video, ...vision, ...wait(false), ];