Skip to main content
Glama

list_pages

Retrieve a list of open browser tabs with their index, title, and URL, highlighting the currently selected tab for browser automation workflows.

Instructions

List open tabs (index, title, URL). Selected tab is marked.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'list_pages' tool. It retrieves the current tabs from Firefox, identifies the selected tab, formats the list using formatPageList, and returns a success response.
    export async function handleListPages(_args: unknown): Promise<McpToolResponse> { try { const { getFirefox } = await import('../index.js'); const firefox = await getFirefox(); await firefox.refreshTabs(); const tabs = firefox.getTabs(); const selectedIdx = firefox.getSelectedTabIdx(); return successResponse(formatPageList(tabs, selectedIdx)); } catch (error) { return errorResponse(error as Error); } }
  • Tool definition including name, description, and empty input schema for 'list_pages'.
    export const listPagesTool = { name: 'list_pages', description: 'List open tabs (index, title, URL). Selected tab is marked.', inputSchema: { type: 'object', properties: {}, }, };
  • src/index.ts:107-112 (registration)
    Registration of the 'list_pages' handler in the toolHandlers Map, mapping tool name to its execution function.
    // Pages ['list_pages', tools.handleListPages], ['new_page', tools.handleNewPage], ['navigate_page', tools.handleNavigatePage], ['select_page', tools.handleSelectPage], ['close_page', tools.handleClosePage],
  • src/index.ts:151-156 (registration)
    Inclusion of the 'listPagesTool' schema in the allTools array, used for listing available tools.
    // Pages tools.listPagesTool, tools.newPageTool, tools.navigatePageTool, tools.selectPageTool, tools.closePageTool,
  • Helper function to format the list of pages/tabs into a compact string representation, marking the selected tab.
    function formatPageList( tabs: Array<{ title?: string; url?: string }>, selectedIdx: number ): string { if (tabs.length === 0) { return '📄 No pages'; } const lines: string[] = [`📄 ${tabs.length} pages (selected: ${selectedIdx})`]; for (const tab of tabs) { const idx = tabs.indexOf(tab); const marker = idx === selectedIdx ? '>' : ' '; const title = (tab.title || 'Untitled').substring(0, 40); lines.push(`${marker}[${idx}] ${title}`); } return lines.join('\n'); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/freema/firefox-devtools-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server