browser_close
Automatically close web pages during browser automation to manage resources efficiently using Cloudflare Playwright MCP's browser control capabilities.
Instructions
Close the page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/common.ts:31-38 (handler)Handler function for the 'browser_close' tool. It closes the current browser context and returns a code snippet simulating 'await page.close()' with flags to disable snapshot and network wait.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 name, title, description, empty input schema, and readOnly type.schema: { name: 'browser_close', title: 'Close browser', description: 'Close the page', inputSchema: z.object({}), type: 'readOnly', },
- src/tools/common.ts:20-39 (registration)Tool registration using defineTool, which defines the 'browser_close' tool with its schema and handler.const close = defineTool({ capability: 'core', schema: { name: 'browser_close', title: 'Close browser', description: 'Close the page', inputSchema: z.object({}), type: 'readOnly', }, handle: async context => { await context.close(); return { code: [`await page.close()`], captureSnapshot: false, waitForNetwork: false, }; }, });
- src/tools/common.ts:75-78 (registration)Export of the tools array including the 'close' (browser_close) tool for registration in the MCP tools system.export default (captureSnapshot: boolean) => [ close, resize(captureSnapshot) ];