Skip to main content
Glama
jomon003

PlayMCP Browser Automation Server

by jomon003

openBrowser

Launch a new browser instance for web scraping, testing, and interaction using Playwright. Configure headless mode and debugging options to automate tasks efficiently.

Instructions

Launch a new browser instance

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
debugNo
headlessNo

Implementation Reference

  • The main handler function that launches a Chromium browser instance using Playwright, handling headless mode and debug logging.
    async openBrowser(headless: boolean = false, debug: boolean = false): Promise<void> { try { this.state.debug = debug; this.log('Attempting to launch browser'); if (this.state.browser?.isConnected()) { this.log('Browser already running'); return; } this.log('Launching new browser instance', { headless }); this.state.browser = await chromium.launch({ headless, args: ['--no-sandbox'] }); this.log('Creating browser context'); this.state.context = await this.state.browser.newContext({ viewport: { width: 1280, height: 720 } }); this.log('Creating new page'); this.state.page = await this.state.context.newPage(); this.log('Browser successfully launched'); } catch (error: any) { console.error('Browser launch error:', error); throw new BrowserError( 'Failed to launch browser', `Technical details: ${error?.message || 'Unknown error'}` ); } }
  • Input schema definition for the openBrowser tool, specifying optional boolean parameters for headless and debug modes.
    const OPEN_BROWSER_TOOL: Tool = { name: "openBrowser", description: "Launch a new browser instance", inputSchema: { type: "object", properties: { headless: { type: "boolean" }, debug: { type: "boolean" } }, required: [] } };
  • src/server.ts:515-515 (registration)
    Registration of the openBrowser tool in the tools object provided to the MCP server capabilities.
    openBrowser: OPEN_BROWSER_TOOL,
  • src/server.ts:576-584 (registration)
    Dispatch handler in callTool request handler that invokes the openBrowser controller method with parsed arguments.
    case 'openBrowser': { await playwrightController.openBrowser( args.headless as boolean, args.debug as boolean ); return { content: [{ type: "text", text: "Browser opened 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