Skip to main content
Glama

launch_browser

Launch a new browser instance (Chromium, Firefox, or WebKit) with headless mode and custom viewport support for web automation tasks via the MCP Browser Server.

Instructions

Launch a new browser instance (chromium, firefox, or webkit)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
browserNoBrowser engine to usechromium
headlessNoRun browser in headless mode
viewportNo

Implementation Reference

  • Implements the launch_browser tool handler: parses input schema, closes existing browser if any, launches new Playwright browser (chromium/firefox/webkit) with specified options, creates context and page, sets up console logging, and returns success message.
    case 'launch_browser': {
      const params = LaunchBrowserSchema.parse(args);
      
      // Close existing browser if any
      if (currentBrowser) {
        await currentBrowser.close();
      }
    
      // Clear console logs
      consoleLogs = [];
    
      // Launch new browser
      const browserType = params.browser === 'firefox' ? firefox : 
                        params.browser === 'webkit' ? webkit : chromium;
      
      currentBrowser = await browserType.launch({ 
        headless: params.headless 
      });
      
      currentContext = await currentBrowser.newContext({
        viewport: params.viewport ? {
          width: params.viewport.width,
          height: params.viewport.height
        } : undefined
      });
      
      currentPage = await currentContext.newPage();
    
      // Set up console event listener
      currentPage.on('console', (msg) => {
        consoleLogs.push({
          level: msg.type(),
          message: msg.text(),
          timestamp: new Date()
        });
      });
    
      return {
        content: [
          {
            type: 'text',
            text: `Browser ${params.browser} launched successfully ${params.headless ? '(headless)' : '(headed)'}`
          }
        ]
      };
    }
  • Zod schema defining input parameters for launch_browser: browser type (default chromium), headless mode (default true), optional viewport dimensions.
    const LaunchBrowserSchema = z.object({
      browser: z.enum(['chromium', 'firefox', 'webkit']).default('chromium'),
      headless: z.boolean().default(true),
      viewport: z.object({
        width: z.number().default(1280),
        height: z.number().default(1024)
      }).optional()
    });
  • src/index.ts:131-157 (registration)
    Registers the launch_browser tool in the ListTools response, providing name, description, and JSON schema matching the Zod schema.
    {
      name: 'launch_browser',
      description: 'Launch a new browser instance (chromium, firefox, or webkit)',
      inputSchema: {
        type: 'object',
        properties: {
          browser: {
            type: 'string',
            enum: ['chromium', 'firefox', 'webkit'],
            default: 'chromium',
            description: 'Browser engine to use'
          },
          headless: {
            type: 'boolean',
            default: true,
            description: 'Run browser in headless mode'
          },
          viewport: {
            type: 'object',
            properties: {
              width: { type: 'number', default: 1280 },
              height: { type: 'number', default: 720 }
            }
          }
        }
      }
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It mentions browser types and headless mode (implied from schema), but doesn't disclose critical behaviors like whether this creates a persistent session, what permissions are needed, potential performance impacts, error conditions, or what happens after launch. For a tool that likely initiates a complex resource, this leaves significant gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action and includes essential browser options. There's no wasted language or redundancy. It's appropriately sized for a tool with three parameters and clear primary function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (launching a browser instance with configuration options), no annotations, no output schema, and incomplete parameter documentation (67% coverage), the description is insufficient. It doesn't explain what the tool returns, how to use the launched browser with other tools, error handling, or resource management implications. The context signals indicate this tool operates within a browser automation suite, but the description doesn't integrate with that context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 67% (2 of 3 parameters have descriptions), so the baseline is 3. The description adds marginal value by explicitly listing browser options ('chromium, firefox, or webkit') which mirrors the enum in the schema, and implies headless mode through the parenthetical. However, it doesn't explain viewport configuration or provide additional context beyond what the schema already documents for the covered parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Launch') and resource ('a new browser instance') with specific browser options listed. It distinguishes from siblings like 'close_browser' by indicating creation rather than termination, though it doesn't explicitly contrast with all sibling tools. The purpose is unambiguous but could be more specific about the tool's role within the browser automation context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'navigate' or 'get_page_info', nor does it mention prerequisites or typical workflow context. It lists browser options but doesn't explain why one might choose chromium over firefox, or when headless mode is appropriate. Usage is implied only by the tool name and action.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related 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/Wladastic/mcp-browser-server'

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