list-browsers
Retrieve active browser instances with detailed tab and title information to monitor and manage browser automation tasks on MCP Fetch.
Instructions
List all active browser instances with their details including tabs and titles
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The main handler function listBrowsers() that lists active Puppeteer browser instances with details on tabs, URLs, titles, and connection status.export async function listBrowsers() { const browsers = getBrowsers() const browserIds = Object.keys(browsers) if (browserIds.length === 0) { return JSON.stringify({ success: true, browsers: [], message: "No active browser instances", }, null, 2) } const browserList = await Promise.all( browserIds.map(async (id) => { const browserInstance = browsers[id] const { browser, createdAt } = browserInstance try { // Get all pages (tabs) from the browser const pages = await browser.pages() // Get tab information const tabs = await Promise.all( pages.map(async (page, index) => { const url = page.url() const title = await page.title().catch(() => "Untitled") return { index, url, title, } }) ) return { id, createdAt: createdAt.toISOString(), tabCount: tabs.length, tabs, isConnected: browser.connected, } } catch (error) { // If we can't get browser info, it might be disconnected return { id, createdAt: createdAt.toISOString(), error: "Failed to get browser information", isConnected: false, } } }) ) return JSON.stringify({ success: true, browserCount: browserList.length, browsers: browserList, }, null, 2) }
- src/tools/puppeteer.ts:16-18 (schema)Zod schema defining the input parameters for the list-browsers action (no parameters required).z.object({ type: z.literal("list-browsers"), }),
- src/tools/puppeteer.ts:101-103 (registration)Dispatch/registration of the list-browsers action within the puppeteer tool handler switch statement.case "list-browsers": return await listBrowsers()