close_browser
Terminates the active browser instance on Chromium ARM64 Browser, ensuring cleanup after web automation or testing tasks on ARM64 devices like Raspberry Pi.
Instructions
Close the browser instance
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index-browser-only.js:395-411 (handler)Handler function that closes the WebSocket connection to the browser tab, kills the Chromium process, resets tab ID, and returns a success message.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:162-170 (registration)Registration of the 'close_browser' tool in the ListTools response, including name, description, and empty input schema.{ name: 'close_browser', description: 'Close the browser instance', inputSchema: { type: 'object', properties: {}, }, }, ],
- index.js:1083-1109 (handler)Enhanced handler function that closes the WebSocket, gracefully kills the Chromium process with timeout fallback to SIGKILL, resets state, and returns success.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 full-featured server's ListTools response, with name, description, and empty input schema.name: 'close_browser', description: 'Close the browser instance', inputSchema: { type: 'object', properties: {}, }, },
- index-browser-only.js:186-187 (schema)Dispatch case in CallToolRequest handler that routes 'close_browser' calls to the closeBrowser method.case 'close_browser': return await this.closeBrowser();