Skip to main content
Glama

set_active_tab

Switch focus to a specific browser tab by specifying its ID using Firefox MCP Server, enabling streamlined automation and multi-tab debugging in Firefox via Playwright.

Instructions

Set active tab

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tabIdYes

Implementation Reference

  • The core handler function for the 'set_active_tab' tool. It validates the tab exists, sets it as the active tab (this.activeTabId = tabId), and returns a success message.
    async setActiveTab(args) {
      const { tabId } = args;
      
      if (!this.pages.has(tabId)) {
        throw new Error(`Tab '${tabId}' not found`);
      }
    
      this.activeTabId = tabId;
      return {
        content: [{ type: 'text', text: `Active tab set to '${tabId}'` }]
      };
    }
  • Registers the 'set_active_tab' tool in the tools list provided to ListToolsRequestSchema, including name, description, and input schema.
    {
      name: 'set_active_tab',
      description: 'Set active tab',
      inputSchema: {
        type: 'object',
        properties: { tabId: { type: 'string' } },
        required: ['tabId']
      }
    },
  • Defines the input schema for the 'set_active_tab' tool, requiring a 'tabId' string.
    inputSchema: {
      type: 'object',
      properties: { tabId: { type: 'string' } },
      required: ['tabId']
  • Dispatches calls to the 'set_active_tab' tool to the setActiveTab method within the central CallToolRequestSchema handler.
    case 'set_active_tab':
      return await this.setActiveTab(args);

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