Skip to main content
Glama

list_pages

Display all open browser tabs with their index, title, and URL to identify and manage web pages for automation tasks.

Instructions

List all open tabs with index, title, and URL. The currently selected tab is marked. Use the index with select_page.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main execution handler for the list_pages tool. It connects to Firefox, refreshes tabs, gets the list and selected index, formats it, and returns as 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); } }
  • The tool schema definition, specifying name, description, and empty input schema (no parameters required).
    export const listPagesTool = { name: 'list_pages', description: 'List open tabs (index, title, URL). Selected tab is marked.', inputSchema: { type: 'object', properties: {}, }, };
  • Helper function that formats the list of tabs into a readable string, 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'); }
  • src/index.ts:108-108 (registration)
    Registration of the handler function in the central toolHandlers Map used by the MCP server.
    ['list_pages', tools.handleListPages],
  • src/index.ts:152-152 (registration)
    Registration of the tool schema in the allTools array used for listing available tools.
    tools.listPagesTool,

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