pilot_tab_select
Switch to a specific browser tab by its ID to continue automation or bring a background tab to the foreground.
Instructions
Switch the active browser context to a specific tab by its ID. Use when the user wants to work in a different tab, bring a background tab to the foreground, or continue automation in a previously opened tab. Use pilot_tabs to find tab IDs.
Parameters:
id: The tab ID to switch to (from pilot_tabs output)
Returns: Confirmation with the tab ID that is now active.
Errors:
"No such tab": The provided tab ID does not exist. Run pilot_tabs to see valid IDs.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Tab ID to switch to |
Implementation Reference
- src/tools/tabs.ts:100-128 (handler)The handler function for the 'pilot_tab_select' tool. It switches the active browser context to a specific tab by ID. When the Chrome extension is connected, it sends a 'switch_tab' message and calls setExtActiveTab; otherwise, it calls bm.switchTab(id) on the Playwright BrowserManager.
server.tool( 'pilot_tab_select', `Switch the active browser context to a specific tab by its ID. Use when the user wants to work in a different tab, bring a background tab to the foreground, or continue automation in a previously opened tab. Use pilot_tabs to find tab IDs. Parameters: - id: The tab ID to switch to (from pilot_tabs output) Returns: Confirmation with the tab ID that is now active. Errors: - "No such tab": The provided tab ID does not exist. Run pilot_tabs to see valid IDs.`, { id: z.number().describe('Tab ID to switch to') }, async ({ id }) => { await bm.ensureBrowser(); try { const ext = bm.getExtension(); if (ext) { await ext.send('switch_tab', { tabId: id }); bm.setExtActiveTab(id); return { content: [{ type: 'text' as const, text: `Switched to tab ${id}` }] }; } bm.switchTab(id); return { content: [{ type: 'text' as const, text: `Switched to tab ${id}` }] }; } catch (err) { return { content: [{ type: 'text' as const, text: wrapError(err) }], isError: true }; } } ); - src/tools/tabs.ts:101-112 (schema)Schema definition for 'pilot_tab_select': expects a single parameter 'id' (z.number) representing the tab ID to switch to. Includes description, parameter documentation, and error messages.
'pilot_tab_select', `Switch the active browser context to a specific tab by its ID. Use when the user wants to work in a different tab, bring a background tab to the foreground, or continue automation in a previously opened tab. Use pilot_tabs to find tab IDs. Parameters: - id: The tab ID to switch to (from pilot_tabs output) Returns: Confirmation with the tab ID that is now active. Errors: - "No such tab": The provided tab ID does not exist. Run pilot_tabs to see valid IDs.`, { id: z.number().describe('Tab ID to switch to') }, - src/tools/register.ts:43-43 (registration)The tool name 'pilot_tab_select' is listed in the STANDARD_TOOLS set, meaning it is registered as a 'standard' profile tool. It is registered via registerTabTools() in the 'standard' and 'full' tool profiles.
'pilot_tabs', 'pilot_tab_new', 'pilot_tab_close', 'pilot_tab_select', - src/browser-manager.ts:91-94 (helper)Helper utility setExtActiveTab(tabId) called by the pilot_tab_select handler to update the active extension tab ID. Also the switchTab(id) method at line 247 that is called when the extension is not connected.
/** Update the active extension tab (called by pilot_tab_new / pilot_tab_select) */ setExtActiveTab(tabId: number): void { this._extActiveTab = tabId; }