close_browser
Close the active browser instance to free system resources and end automation sessions. This tool terminates browser processes controlled through the Chrome DevTools Protocol.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.js:91-99 (registration)Registers the 'close_browser' MCP tool with an empty input schema. The inline handler function closes the global Playwright browser instance if it exists, resets the associated page and CDP session variables to null, and returns a confirmation message in the expected MCP response format.server.tool("close_browser", {}, async () => { if (browser) { await browser.close(); browser = null; page = null; cdp = null; } return { content: [{ type: "text", text: "Browser closed" }] }; });
- server.js:91-99 (handler)The handler function for the 'close_browser' tool. It checks if a browser instance exists (global variable), closes it using Playwright's browser.close(), resets the browser, page, and cdp globals to null, and returns a structured MCP response confirming the action.server.tool("close_browser", {}, async () => { if (browser) { await browser.close(); browser = null; page = null; cdp = null; } return { content: [{ type: "text", text: "Browser closed" }] }; });