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');
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that the selected tab is marked, which adds useful context beyond a basic list operation. However, it lacks critical details: whether this requires an active browser context, if it returns all tabs or just visible ones, potential rate limits, error conditions (e.g., no tabs open), or the return format (e.g., array of objects). For a tool with zero annotation coverage, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise—a single sentence that efficiently conveys the core functionality (listing open tabs), the data returned (index, title, URL), and an important behavioral detail (selected tab marking). Every word earns its place with no redundancy or fluff, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (listing browser tabs with selection marking), lack of annotations, and no output schema, the description is incomplete. It doesn't explain the return structure (e.g., JSON array format), how 'marked' is indicated, whether tabs are filtered (e.g., only in current window), or error handling. For a tool interacting with browser state, more context is needed for reliable agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, and schema description coverage is 100% (empty schema). The description appropriately doesn't discuss parameters since none exist. It focuses on what the tool does rather than inputs, which is correct for a parameterless tool. No additional parameter information is needed or provided.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('List') and resource ('open tabs'), and specifies what information is returned (index, title, URL) plus additional behavior (selected tab marking). It distinguishes itself from siblings like 'select_page' or 'close_page' by focusing on listing rather than manipulation. However, it doesn't explicitly differentiate from 'list_console_messages' or 'list_network_requests' beyond the resource type.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., whether a browser session must be active), when not to use it, or how it relates to sibling tools like 'select_page' for tab selection or 'close_page' for tab management. The agent must infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/mozilla/firefox-devtools-mcp'

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