Skip to main content
Glama

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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}`, }, ], }; } });
  • 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}`, }, ], }; } });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pshivapr/selenium-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server