Skip to main content
Glama

new_tab

Open a new browser tab in Puppeteer MCP Server to navigate to URLs, enabling AI agents to automate web interactions across multiple tabs for tasks like content extraction and form filling.

Instructions

Open a new browser tab, optionally navigating to a URL. The new tab becomes active.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlNoURL to navigate to in the new tab

Implementation Reference

  • Zod schema defining the input for the new_tab tool: optional URL string.
    export const newTabSchema = z.object({ url: z.string().url().optional().describe('URL to navigate to in the new tab'), });
  • Registration of the 'new_tab' tool on the MCP server, including tool name, description, input schema reference, and inline handler function that calls createTab.
    server.tool( 'new_tab', 'Open a new browser tab, optionally navigating to a URL. The new tab becomes active.', newTabSchema.shape, async ({ url }) => { const result = await createTab(url); return handleResult(result); } );
  • Main handler logic for creating a new tab: uses Puppeteer to create a new page, generates tab ID, registers the page in internal state, sets as active, optionally navigates to URL, and returns tab information.
    */ export async function createTab(url?: string): Promise<Result<TabInfo>> { const browserResult = await ensureInitialized(); if (!browserResult.success) { return browserResult; } try { const page = await browserResult.data.newPage(); const tabId = generateTabId(); registerPage(tabId, page); state.activeTabId = tabId; if (url) { await page.goto(url); } return ok({ id: tabId, url: page.url(), title: await page.title(), isActive: true, }); } catch (error) { const message = error instanceof Error ? error.message : String(error); return err(browserNotLaunched()); } }

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/andytango/puppeteer-mcp'

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