browser_install
Install the browser specified in the configuration to resolve errors when the browser is not found, ensuring smooth operation with the Playwright MCP server.
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 for the 'browser_install' tool. It installs the browser (default 'chrome') specified in the config by forking the Playwright CLI 'install' command, streams output, awaits completion, and sets tabs on response.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 for the 'browser_install' tool, defining its name, title, description, empty input schema (no parameters), and marking it as destructive.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:56-58 (registration)Exports the defined 'install' tool (which includes 'browser_install') as a default array for inclusion in the main tools list.export default [ install, ];
- src/tools.ts:36-52 (registration)Registers all tools including the 'browser_install' from './tools/install.js' by spreading the import into the 'allTools' array, which is exported for use.export const allTools: Tool<any>[] = [ ...common, ...console, ...dialogs, ...evaluate, ...files, ...install, ...keyboard, ...navigate, ...network, ...mouse, ...pdf, ...screenshot, ...snapshot, ...tabs, ...wait, ];