Skip to main content
Glama

close_browser

Automatically close the Firefox browser and all active tabs using the MCP Server, ensuring clean termination of browser sessions for controlled automation workflows.

Instructions

Close browser and all tabs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The primary handler function for the 'close_browser' tool. It closes the Playwright Firefox browser instance, clears all associated contexts, pages, active tabs, and debug monitoring buffers (console logs, JS errors, network activity, etc.), and returns a text confirmation message.
    async closeBrowser() { if (this.browser) { await this.browser.close(); this.browser = null; this.contexts.clear(); this.pages.clear(); this.activeTabId = null; // Clear all debug buffers this.consoleLogs.clear(); this.jsErrors.clear(); this.networkActivity.clear(); this.wsMessages.clear(); this.performanceMetrics.clear(); } return { content: [{ type: 'text', text: 'Firefox browser closed, all tabs and debug buffers cleared' }] }; }
  • Registration/dispatch in the CallToolRequestSchema handler's switch statement, which maps incoming 'close_browser' tool calls to the closeBrowser() method.
    case 'close_browser': return await this.closeBrowser();
  • Input schema definition for the 'close_browser' tool in the ListToolsRequestSchema response. Defines the tool with no required input parameters.
    { name: 'close_browser', description: 'Close browser and all tabs', inputSchema: { type: 'object', properties: {} } },

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/JediLuke/firefox-mcp-server'

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