close_browser
Close the active Chromium browser instance to free system resources and complete automation sessions on ARM64 devices.
Instructions
Close the browser instance
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.js:1083-1109 (handler)The main handler function for the 'close_browser' tool. Closes the WebSocket connection to Chromium, terminates the Chromium process gracefully (with timeout fallback to SIGKILL), resets state variables, and returns a success message.async closeBrowser() { if (wsConnection) { wsConnection.close(); wsConnection = null; } if (chromiumProcess && chromiumProcess.exitCode === null) { chromiumProcess.kill('SIGTERM'); // Wait for graceful shutdown await new Promise(resolve => { chromiumProcess.on('exit', resolve); setTimeout(() => { chromiumProcess.kill('SIGKILL'); resolve(); }, 5000); }); chromiumProcess = null; } currentTabId = null; return { content: [{ type: 'text', text: 'Browser closed successfully' }], }; }
- index.js:336-342 (registration)Registration of the 'close_browser' tool in the tools list provided to MCP's handleToolsListRequest, including empty input schema.name: 'close_browser', description: 'Close the browser instance', inputSchema: { type: 'object', properties: {}, }, },
- index-browser-only.js:395-411 (handler)Handler function for 'close_browser' in the browser-only variant of the MCP server. Similar to main implementation but simpler process termination.async closeBrowser() { if (wsConnection) { wsConnection.close(); wsConnection = null; } if (chromiumProcess) { chromiumProcess.kill('SIGTERM'); chromiumProcess = null; } currentTabId = null; return { content: [{ type: 'text', text: 'Browser closed successfully' }], }; }
- index-browser-only.js:163-169 (registration)Registration of the 'close_browser' tool in the browser-only server's tools list.name: 'close_browser', description: 'Close the browser instance', inputSchema: { type: 'object', properties: {}, }, },
- chromium_tool.py:115-123 (handler)Python wrapper/client handler that calls the MCP server for 'close_browser' tool.def close_browser(self) -> str: """Close the browser instance.""" result = self._call_mcp_server("close_browser", {}) if "error" in result: return f"Error: {result['error']}" content = result.get("content", [{}]) return content[0].get("text", "Browser closed")