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
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | The URL to navigate to in the new tab. If not provided, the new tab will be blank. |
Implementation Reference
- src/tools/tabs.ts:69-74 (handler)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(); },
- src/tools/tabs.ts:59-67 (schema)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', },
- src/tools/tabs.ts:96-101 (registration)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, ];
- src/context.ts:67-72 (helper)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; }