browser_close
Close the current browser page in Playwright MCP to end web automation sessions and manage browser resources.
Instructions
Close the page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/common.ts:31-38 (handler)The handle function for the 'browser_close' tool. It closes the current browser context using context.close() and returns a code snippet indicating page.close() without capturing a snapshot or waiting for network events.handle: async context => { await context.close(); return { code: [`await page.close()`], captureSnapshot: false, waitForNetwork: false, }; },
- src/tools/common.ts:23-29 (schema)Schema definition for the 'browser_close' tool, specifying its name, title, description, empty input schema (no parameters), and readOnly type.schema: { name: 'browser_close', title: 'Close browser', description: 'Close the page', inputSchema: z.object({}), type: 'readOnly', },
- src/tools.ts:36-52 (registration)Registration of browser_close tool as part of snapshotTools array via spreading common(true), which includes the close tool.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 browser_close tool as part of visionTools array via spreading common(false), which includes the close tool.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), ];
- src/connection.ts:30-33 (registration)Final registration where snapshotTools or visionTools (containing browser_close) are selected as allTools, filtered, and passed to the Context used by the MCP server.const allTools = config.vision ? visionTools : snapshotTools; const tools = allTools.filter(tool => !config.capabilities || tool.capability === 'core' || config.capabilities.includes(tool.capability)); validateConfig(config); const context = new Context(tools, config, browserContextFactory);