Skip to main content
Glama

create_tab

Open a new Firefox tab with isolated session and debugging capabilities, enabling controlled browser automation and advanced multi-tab monitoring.

Instructions

Create a new tab with isolated session and debugging

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contextIdNo
enableMonitoringNo
tabIdYes
urlNoabout:blank

Implementation Reference

  • Main handler function for 'create_tab' tool. Creates a new browser context and page (tab), initializes debug buffers, optionally sets up monitoring, navigates to the specified URL, stores the page, and sets it as active if none exists.
    async createTab(args) {
      this.ensureBrowserRunning();
      const { tabId, url = 'about:blank', contextId, enableMonitoring = true } = args;
      
      if (this.pages.has(tabId)) {
        throw new Error(`Tab with ID '${tabId}' already exists`);
      }
    
      // Create or reuse context
      const effectiveContextId = contextId || `context-${tabId}`;
      let context;
      
      if (this.contexts.has(effectiveContextId)) {
        context = this.contexts.get(effectiveContextId);
      } else {
        context = await this.browser.newContext({
          storageState: undefined // Start with clean state
        });
        this.contexts.set(effectiveContextId, context);
      }
    
      // Create new page in the context
      const page = await context.newPage();
      
      // Initialize debug buffers
      this.initDebugBuffers(tabId);
      
      // Setup monitoring if enabled
      if (enableMonitoring) {
        await this.setupPageMonitoring(page, tabId);
      }
      
      await page.goto(url);
      this.pages.set(tabId, page);
      
      // Set as active tab if no active tab exists
      if (!this.activeTabId) {
        this.activeTabId = tabId;
      }
    
      return {
        content: [{
          type: 'text',
          text: `Tab '${tabId}' created with debugging ${enableMonitoring ? 'enabled' : 'disabled'}. URL: ${url}. Context: ${effectiveContextId}`
        }]
      };
    }
  • Input schema definition for the 'create_tab' tool, specifying parameters tabId (required), url, contextId, enableMonitoring.
    name: 'create_tab',
    description: 'Create a new tab with isolated session and debugging',
    inputSchema: {
      type: 'object',
      properties: {
        tabId: { type: 'string' },
        url: { type: 'string', default: 'about:blank' },
        contextId: { type: 'string' },
        enableMonitoring: { type: 'boolean', default: true }
      },
      required: ['tabId']
    }
  • Registration/dispatch in the CallToolRequestSchema handler switch statement, calling the createTab method.
    case 'create_tab':
      return await this.createTab(args);
  • Tool registration object in the ListToolsRequestSchema response tools array.
    {
      name: 'create_tab',
      description: 'Create a new tab with isolated session and debugging',
      inputSchema: {
        type: 'object',
        properties: {
          tabId: { type: 'string' },
          url: { type: 'string', default: 'about:blank' },
          contextId: { type: 'string' },
          enableMonitoring: { type: 'boolean', default: true }
        },
        required: ['tabId']
      }
    },

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/JediLuke/firefox-mcp-server'

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