pilot_tab_new
Open a new browser tab, optionally navigating to a URL. Returns the tab ID and URL.
Instructions
Open a new browser tab, optionally navigating to a URL. Use when the user wants to open a link in a new tab, create a blank tab, or work with multiple pages simultaneously.
Parameters:
url: Optional URL to navigate to in the new tab (omit for a blank about:blank tab)
Returns: The new tab's ID and URL (if provided).
Errors:
"Invalid URL": The URL is malformed. Provide a complete URL with protocol.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | URL to navigate to in the new tab |
Implementation Reference
- src/tools/tabs.ts:40-68 (handler)Handler for pilot_tab_new tool — opens a new browser tab with optional URL. Delegates to browser extension (ext.send) or Playwright (bm.newTab) depending on whether extension is connected.
server.tool( 'pilot_tab_new', `Open a new browser tab, optionally navigating to a URL. Use when the user wants to open a link in a new tab, create a blank tab, or work with multiple pages simultaneously. Parameters: - url: Optional URL to navigate to in the new tab (omit for a blank about:blank tab) Returns: The new tab's ID and URL (if provided). Errors: - "Invalid URL": The URL is malformed. Provide a complete URL with protocol.`, { url: z.string().optional().describe('URL to navigate to in the new tab') }, async ({ url }) => { await bm.ensureBrowser(); try { const ext = bm.getExtension(); if (ext) { const res = await ext.send<{ tabId: number }>('new_tab', { url }); bm.setExtActiveTab(res.tabId); return { content: [{ type: 'text' as const, text: `Opened tab ${res.tabId}${url ? ` → ${url}` : ''}` }] }; } const id = await bm.newTab(url); return { content: [{ type: 'text' as const, text: `Opened tab ${id}${url ? ` → ${url}` : ''}` }] }; } catch (err) { return { content: [{ type: 'text' as const, text: wrapError(err) }], isError: true }; } } ); - src/tools/tabs.ts:52-52 (schema)Input schema for pilot_tab_new — accepts an optional URL string parameter.
{ url: z.string().optional().describe('URL to navigate to in the new tab') }, - src/tools/register.ts:43-43 (registration)pilot_tab_new is registered in the 'standard' tool profile set, which determines which tools are available based on the configured profile.
'pilot_tabs', 'pilot_tab_new', 'pilot_tab_close', 'pilot_tab_select', - src/tools/register.ts:83-83 (registration)The registerAllTools function invokes registerTabTools (from tabs.ts) which registers pilot_tab_new via server.tool().
registerTabTools(effectiveServer, bm); - src/browser-manager.ts:212-227 (helper)BrowserManager.newTab helper used as fallback when no browser extension is connected — creates a new Playwright page, optionally navigates to the given URL.
// ─── Tab Management ──────────────────────────────────────── async newTab(url?: string): Promise<number> { if (!this.context) throw new Error('Browser not launched'); if (url) await validateNavigationUrl(url); const page = await this.context.newPage(); const id = this.nextTabId++; this.pages.set(id, page); this.activeTabId = id; this.wirePageEvents(page); if (url) { await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 15000 }); } return id; }