Skip to main content
Glama

browser_open

Open a new browser session for web automation. Launch Chrome, Firefox, Edge, or Safari with configurable options to start browser-based tasks.

Instructions

Open a new browser session

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
browserYesBrowser to launch
optionsNo

Implementation Reference

  • The core handler function for the browser_open tool. It launches the specified browser using BrowserService.createDriver, generates a unique session ID, stores the driver in StateManager, sets the current session, and returns a success or error message in MCP format.
    async ({ browser, options = {} }) => {
      try {
        const driver = await BrowserService.createDriver(browser, {
          ...options,
          headless: typeof options.headless === 'boolean' ? options.headless : false,
          arguments: options.arguments ?? [],
        });
        const sessionId = `${browser}_${Date.now()}`;
    
        stateManager.addDriver(sessionId, driver);
        stateManager.setCurrentSession(sessionId);
    
        return {
          content: [
            {
              type: 'text',
              text: `Browser started with session_id: ${sessionId}`,
            },
          ],
        };
      } catch (e) {
        return {
          content: [
            {
              type: 'text',
              text: `Error starting browser: ${(e as Error).message}`,
            },
          ],
        };
      }
  • The registration of the browser_open tool using server.tool(), including the tool name, description, input schema (browser type and options), and the inline handler function.
    server.tool(
      'browser_open',
      'Open a new browser session',
      {
        browser: z.enum(['chrome', 'firefox', 'edge', 'safari']).describe('Browser to launch'),
        options: browserOptionsSchema,
      },
      async ({ browser, options = {} }) => {
        try {
          const driver = await BrowserService.createDriver(browser, {
            ...options,
            headless: typeof options.headless === 'boolean' ? options.headless : false,
            arguments: options.arguments ?? [],
          });
          const sessionId = `${browser}_${Date.now()}`;
    
          stateManager.addDriver(sessionId, driver);
          stateManager.setCurrentSession(sessionId);
    
          return {
            content: [
              {
                type: 'text',
                text: `Browser started with session_id: ${sessionId}`,
              },
            ],
          };
        } catch (e) {
          return {
            content: [
              {
                type: 'text',
                text: `Error starting browser: ${(e as Error).message}`,
              },
            ],
          };
        }
      }
    );
  • Zod schema definition for browserOptionsSchema, which defines optional headless mode and arguments parameters used in the browser_open tool's input schema.
    export const browserOptionsSchema = z
      .object({
        headless: z.boolean().optional().describe('Run browser in headless mode'),
        arguments: z.array(z.string()).optional().describe('Additional browser arguments'),
      })
      .optional();
  • BrowserService.createDriver method, a supporting utility called by the browser_open handler to instantiate the appropriate WebDriver based on the browser type and options.
    static async createDriver(
      browser: 'chrome' | 'firefox' | 'edge' | 'safari',
      options: BrowserOptions = {}
    ): Promise<WebDriver> {
      switch (browser) {
        case 'chrome':
          return this.createChromeDriver(options);
        case 'edge':
          return this.createEdgeDriver(options);
        case 'firefox':
          return this.createFirefoxDriver(options);
        case 'safari':
          return this.createSafariDriver();
        default:
          throw new Error(`Unsupported browser: ${browser}`);
      }
    }
  • src/server.ts:54-55 (registration)
    Top-level call to registerAllTools during server initialization, which indirectly registers the browser_open tool via the tools index.
    // Register all tools
    registerAllTools(this.server, this.stateManager);
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. 'Open a new browser session' implies initialization but doesn't describe what happens after opening (e.g., does it return a session ID, what permissions are needed, does it persist across tool calls, are there rate limits). This is a significant gap for a tool that likely establishes a foundational session for other operations.

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 extremely concise at just 4 words, front-loading the essential action. There's zero wasted language, making it immediately understandable despite its brevity.

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?

For a tool that likely establishes a browser session for subsequent operations (given the many sibling browser tools), the description is inadequate. With no annotations, no output schema, and minimal parameter guidance, it doesn't provide enough context about what the tool returns, how sessions are managed, or prerequisites for use.

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?

The description mentions no parameters, while the schema has 2 parameters with 50% coverage (only 'browser' has a description). The description doesn't compensate for the schema's gaps, particularly for the 'options' object which has nested properties. However, with 2 parameters total and one well-documented, the baseline of 3 is appropriate given the moderate parameter complexity.

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 ('Open') and resource ('a new browser session'), making the purpose immediately understandable. However, it doesn't differentiate this tool from its many browser-related siblings, which all operate on browser sessions but perform different actions.

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. With 50+ sibling tools for browser interaction, there's no indication whether this should be used first to establish a session, or when other tools might be more appropriate for specific tasks.

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/pshivapr/selenium-mcp'

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