Skip to main content
Glama

get_page_content

Retrieve HTML content from a specific browser tab using a CSS selector. Part of the Firefox MCP Server, enabling precise webpage content extraction for automation and debugging tasks.

Instructions

Get HTML content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorNo
tabIdNo

Implementation Reference

  • The handler function for the 'get_page_content' tool. It ensures the browser is running, retrieves the appropriate page (by tabId or active tab), fetches the HTML content using page.innerHTML(selector) if selector provided or page.content() otherwise, and returns it as MCP content.
    async getPageContent(args = {}) {
      this.ensureBrowserRunning();
      const { selector, tabId } = args;
      const page = this.getPage(tabId);
      
      let content;
      if (selector) {
        content = await page.innerHTML(selector);
      } else {
        content = await page.content();
      }
      
      return {
        content: [{
          type: 'text',
          text: content
        }]
      };
    }
  • The registration of the 'get_page_content' tool in the listTools response, including name, description, and input schema.
    {
      name: 'get_page_content',
      description: 'Get HTML content',
      inputSchema: {
        type: 'object',
        properties: {
          selector: { type: 'string' },
          tabId: { type: 'string' }
        }
      }
    },
  • The dispatch case in the CallToolRequest handler that routes calls to the getPageContent method.
    case 'get_page_content':
      return await this.getPageContent(args);
  • Helper method used by getPageContent to retrieve the Playwright Page object for the specified or active tab.
    getPage(tabId) {
      if (tabId) {
        if (!this.pages.has(tabId)) {
          throw new Error(`Tab '${tabId}' not found`);
        }
        return this.pages.get(tabId);
      } else {
        if (!this.activeTabId || !this.pages.has(this.activeTabId)) {
          throw new Error('No active tab. Use create_tab or set_active_tab first.');
        }
        return this.pages.get(this.activeTabId);
      }
    }
  • Helper method called by getPageContent to ensure the browser instance is available before accessing pages.
    ensureBrowserRunning() {
      if (!this.browser) {
        throw new Error('Firefox browser is not running. Please launch it first using the launch_firefox_multi tool.');
      }
    }
Behavior1/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It fails to describe how the tool behaves: whether it returns raw HTML, handles dynamic content, requires page load completion, or has any side effects (e.g., triggering page events). This is inadequate for a tool with potential complexity in web interactions.

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 with just three words, front-loaded and zero waste. However, this brevity comes at the cost of under-specification, but as per scoring rules, conciseness is rated independently based on efficiency, not completeness.

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 potential complexity (web scraping/interaction), lack of annotations, no output schema, and 0% schema coverage, the description is incomplete. It doesn't cover return values, error conditions, or behavioral nuances, making it insufficient for effective agent use.

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

Parameters2/5

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

The description provides no information about the two parameters ('selector' and 'tabId'), and schema description coverage is 0%, leaving both undocumented. It doesn't explain what 'selector' refers to (e.g., CSS selector for targeting elements) or 'tabId' (e.g., identifier for browser tabs), failing to compensate for the schema gap.

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

Purpose3/5

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

The description 'Get HTML content' states a clear verb ('Get') and resource ('HTML content'), but it's vague about scope and doesn't distinguish from sibling tools like 'get_page_text' or 'get_current_url'. It lacks specificity about what 'HTML content' means (e.g., full page HTML, selected element HTML, or rendered HTML).

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?

No guidance is provided on when to use this tool versus alternatives like 'get_page_text' (for text content) or 'get_current_url' (for URL retrieval). The description doesn't mention prerequisites (e.g., requires a loaded page or active tab) or exclusions, leaving usage context unclear.

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

Related 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/JediLuke/firefox-mcp-server'

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