list_tabs
List all open tabs across browser contexts to locate and focus on a specific tab.
Instructions
List all open tabs across contexts. Use to find a specific tab to focus.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:190-206 (handler)The listTabs() async function that iterates over all browser contexts and pages, collecting index, URL, title, and active status for each tab, returning { tabs }.
async function listTabs() { if (!browser) throw new Error('Not attached. Call `attach` first.'); const tabs: Array<{ index: number; url: string; title: string; active: boolean }> = []; let i = 0; for (const ctx of browser.contexts()) { for (const p of ctx.pages()) { tabs.push({ index: i, url: p.url(), title: await p.title().catch(() => ''), active: p === page, }); i++; } } return { tabs }; } - src/index.ts:353-357 (registration)Tool definition in the TOOLS array: name 'list_tabs', description 'List all open tabs across contexts. Use to find a specific tab to focus.', with empty inputSchema.
{ name: 'list_tabs', description: 'List all open tabs across contexts. Use to find a specific tab to focus.', inputSchema: { type: 'object', properties: {} }, }, - src/index.ts:462-462 (registration)Dispatch case in the CallToolRequestSchema handler: maps the string 'list_tabs' to the listTabs() function call.
case 'list_tabs': result = await listTabs(); break;