Skip to main content
Glama

browser_tab_new

Open a new browser tab with a specified URL or a blank page, enabling efficient web navigation and interaction within Playwright MCP's browser automation environment.

Instructions

Open a new tab

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlNoThe URL to navigate to in the new tab. If not provided, the new tab will be blank.

Implementation Reference

  • The handler function for the 'browser_tab_new' tool. It creates a new tab using context.newTab() and optionally navigates to the provided URL, then includes a snapshot in the response.
    handle: async (context, params, response) => { const tab = await context.newTab(); if (params.url) await tab.navigate(params.url); response.setIncludeSnapshot(); },
  • The schema definition for the 'browser_tab_new' tool, specifying name, title, description, input schema (optional URL), and type.
    schema: { name: 'browser_tab_new', title: 'Open a new tab', description: 'Open a new tab', inputSchema: z.object({ url: z.string().optional().describe('The URL to navigate to in the new tab. If not provided, the new tab will be blank.'), }), type: 'readOnly', },
  • The tabs tools, including 'browser_tab_new' (as newTab), are exported for inclusion in the overall tools list.
    export default [ listTabs, newTab, selectTab, closeTab, ];
  • src/tools.ts:36-52 (registration)
    All tools are collected here, including those from tabs.ts (which contains browser_tab_new), for use by the MCP server.
    export const allTools: Tool<any>[] = [ ...common, ...console, ...dialogs, ...evaluate, ...files, ...install, ...keyboard, ...navigate, ...network, ...mouse, ...pdf, ...screenshot, ...snapshot, ...tabs, ...wait, ];
  • The Context.newTab() helper method used by the tool handler, which creates a new Playwright page (tab).
    async newTab(): Promise<Tab> { const { browserContext } = await this._ensureBrowserContext(); const page = await browserContext.newPage(); this._currentTab = this._tabs.find(t => t.page === page)!; return this._currentTab; }

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/nzjami/mcpPlaywright'

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