Skip to main content
Glama

close_browser

Close the active browser instance to free system resources and end automation sessions. This tool terminates browser processes controlled through the Chrome DevTools Protocol.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • server.js:91-99 (registration)
    Registers the 'close_browser' MCP tool with an empty input schema. The inline handler function closes the global Playwright browser instance if it exists, resets the associated page and CDP session variables to null, and returns a confirmation message in the expected MCP response format.
    server.tool("close_browser", {}, async () => { if (browser) { await browser.close(); browser = null; page = null; cdp = null; } return { content: [{ type: "text", text: "Browser closed" }] }; });
  • server.js:91-99 (handler)
    The handler function for the 'close_browser' tool. It checks if a browser instance exists (global variable), closes it using Playwright's browser.close(), resets the browser, page, and cdp globals to null, and returns a structured MCP response confirming the action.
    server.tool("close_browser", {}, async () => { if (browser) { await browser.close(); browser = null; page = null; cdp = null; } return { content: [{ type: "text", text: "Browser closed" }] }; });
Install Server

Other Tools

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/Myestery/browser-cdp-mcp'

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