Skip to main content
Glama

launch_browser

Launch a new browser instance using Chromium, Firefox, or WebKit, with configurable headless mode and viewport dimensions for automated web tasks.

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

  • Zod schema for launch_browser tool: validates 'browser' (enum chromium/firefox/webkit, default chromium), 'headless' (boolean, default true), and optional 'viewport' (width/height).
    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:130-157 (registration)
    Registration of launch_browser tool in ListToolsRequestSchema handler, defining its name, description, and inputSchema (JSON Schema format).
    tools: [
      {
        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 }
              }
            }
          }
        }
      },
  • Handler for the 'launch_browser' case in CallToolRequestSchema: parses args with LaunchBrowserSchema, closes existing browser if open, clears console logs, launches the selected browser (chromium/firefox/webkit) via Playwright, creates a new context and page, sets up console event listener, and returns a success message.
    switch (name) {
      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)'}`
            }
          ]
        };
      }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It only states the basic action without disclosing side effects (e.g., browser becomes active context, resource consumption, need to close). Behavioral traits needed for safe invocation are absent.

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 sentence that efficiently conveys the core action and supported browsers. No wasted words; front-loaded with the verb and object.

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 three parameters, no output schema, and no annotations, the description is too minimal. It fails to explain when to use the tool, what happens after launch, or how to manage the browser instance (e.g., lifecycle, interaction prerequisites).

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% (browser and headless described, viewport not). The description adds no extra parameter meaning beyond listing browsers; it does not clarify default behavior or viewport structure. Adequate but does not compensate for the missing viewport description.

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

Purpose5/5

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

The description clearly states the action (Launch), the object (a new browser instance), and lists the supported browsers (chromium, firefox, webkit). It distinguishes from siblings like close_browser and navigate, making the purpose unambiguous.

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. It does not mention prerequisites (e.g., that a browser should be closed before launching another) or contrast with close_browser or navigate. Usage context is only implied.

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

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