Skip to main content
Glama

browser_close

Closes the current browser session to free system resources and end automation tasks in Selenium WebDriver.

Instructions

Close the current browser session

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The inline handler function for the 'browser_close' tool, registered via server.tool(). It retrieves the current driver, quits it, cleans up the session state, and returns a confirmation or error 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}`, }, ], }; } });
  • The 'browser_close' tool is registered here within the registerBrowserTools function using server.tool(), with no input schema and the handler inline.
    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