List Tabs
list_tabsRetrieve all open browser tabs with titles and references. Use to manage multiple tabs, access current content, or organize browsing sessions.
Instructions
List all open tabs in the user's browser with their titles and tab references.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| includeUrl | No | Include URLs in the output. Enable only when you need to reference specific URLs. (default: false, hostnames always included) |
Implementation Reference
- src/mcp.ts:126-137 (handler)The handler function for the list_tabs tool in src/mcp.ts, which calls listTabs and formats the output.
async (args) => { const { includeUrl } = args; const tabs = await listTabs(options); return { content: [ { type: "text", text: view.formatList(tabs, includeUrl), }, ], }; } - src/mcp.ts:36-40 (helper)The helper function listTabs that retrieves the browser tab list and filters excluded hosts.
async function listTabs(opts: McpServerOptions): Promise<Tab[]> { const browser = getInterface(opts.browser); const tabs = await browser.getTabList(opts.applicationName); return tabs.filter((t) => !isExcludedHost(t.url, opts.excludeHosts)); } - src/mcp.ts:110-125 (registration)The registration of the list_tabs tool in src/mcp.ts.
server.registerTool( "list_tabs", { title: "List Tabs", description: "List all open tabs in the user's browser with their titles and tab references.", inputSchema: { includeUrl: z .boolean() .optional() .default(false) .describe( "Include URLs in the output. Enable only when you need to reference specific URLs. (default: false, hostnames always included)" ), }, },