Skip to main content
Glama
jomon003

PlayMCP Browser Automation Server

by jomon003

closeBrowser

Terminate the browser session to free system resources and complete automation tasks in PlayMCP Browser Automation Server.

Instructions

Close the browser

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function that closes the Playwright browser instance, context, and page, then resets the state.
    async closeBrowser(): Promise<void> { try { this.log('Closing browser'); await this.state.page?.close(); await this.state.context?.close(); await this.state.browser?.close(); this.state = { browser: null, context: null, page: null, debug: false }; this.log('Browser closed'); } catch (error: any) { console.error('Browser close error:', error); throw new BrowserError('Failed to close browser', 'The browser might have already been closed'); } }
  • Tool schema definition including name, description, and empty input schema (no parameters required).
    const CLOSE_BROWSER_TOOL: Tool = { name: "closeBrowser", description: "Close the browser", inputSchema: { type: "object", properties: {}, required: [] } };
  • src/server.ts:552-552 (registration)
    Registration of the closeBrowser tool in the tools object passed to MCP server capabilities.
    closeBrowser: CLOSE_BROWSER_TOOL
  • Dispatch handler in MCP 'callTool' request that invokes the closeBrowser method.
    case 'closeBrowser': { await playwrightController.closeBrowser(); return { content: [{ type: "text", text: "Browser closed successfully" }] }; }

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/jomon003/PlayMCP'

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