browser_close
Close the current browser session to end web automation tasks and free system resources when testing or interaction workflows are complete.
Instructions
Close the current browser session
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/browserTools.ts:399-423 (handler)Handler for the browser_close tool: quits the WebDriver instance, removes the session from state management, resets the current session, and returns a status message.server.tool('browser_close', 'Close the current browser session', {}, async () => { try { const driver = stateManager.getDriver(); await driver.quit(); const sessionId = stateManager.getCurrentSession(); if (sessionId) { stateManager.removeDriver(sessionId); } stateManager.resetCurrentSession(); return { content: [{ type: 'text', text: `Browser session ${sessionId} closed` }], }; } catch (e) { return { content: [ { type: 'text', text: `Error closing session: ${(e as Error).message}`, }, ], }; } });
- src/tools/browserTools.ts:399-423 (registration)Registration of the browser_close tool using server.tool, with empty input schema and inline handler.server.tool('browser_close', 'Close the current browser session', {}, async () => { try { const driver = stateManager.getDriver(); await driver.quit(); const sessionId = stateManager.getCurrentSession(); if (sessionId) { stateManager.removeDriver(sessionId); } stateManager.resetCurrentSession(); return { content: [{ type: 'text', text: `Browser session ${sessionId} closed` }], }; } catch (e) { return { content: [ { type: 'text', text: `Error closing session: ${(e as Error).message}`, }, ], }; } });