Skip to main content
Glama

pilot_page_html

Extract HTML content from web pages using CSS selectors or retrieve full page HTML for web scraping and automation tasks.

Instructions

Get innerHTML of a selector/ref, or full page HTML if none provided.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
refNoElement ref or CSS selector

Implementation Reference

  • The handler function for the `pilot_page_html` tool, which retrieves either a specific element's innerHTML or the full page content using Playwright.
    server.tool(
      'pilot_page_html',
      'Get innerHTML of a selector/ref, or full page HTML if none provided.',
      { ref: z.string().optional().describe('Element ref or CSS selector') },
      async ({ ref }) => {
        await bm.ensureBrowser();
        try {
          const page = bm.getPage();
          if (ref) {
            const resolved = await bm.resolveRef(ref);
            if ('locator' in resolved) {
              const html = await resolved.locator.innerHTML({ timeout: 5000 });
              return { content: [{ type: 'text' as const, text: html }] };
            }
            const html = await page.innerHTML(resolved.selector);
            return { content: [{ type: 'text' as const, text: html }] };
          }
          const html = await page.content();
          return { content: [{ type: 'text' as const, text: html }] };
        } catch (err) {
          return { content: [{ type: 'text' as const, text: wrapError(err) }], isError: true };
        }
      }
Behavior3/5

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

With no annotations provided, the description carries full disclosure burden. It mentions 'innerHTML' implying string return, but omits error behavior (selector not found), return format structure, size limitations for large pages, or whether this requires an active navigation context.

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?

Extremely concise at 11 words in a single sentence. Every word earns its place: verb ('Get'), resource ('innerHTML'), targeting mechanism ('selector/ref'), and conditional fallback ('full page HTML if none provided').

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

Completeness3/5

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

For a simple single-parameter tool, it covers the basic operation and scoping options. However, lacking both output schema and annotations, it should disclose the return format (string vs object) and error conditions to be complete.

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?

Schema coverage is 100%, establishing a baseline of 3. The description adds valuable semantic context by explaining the default behavior (full page HTML when ref is omitted), clarifying the optional nature of the parameter beyond the schema structure.

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 uses specific technical terminology ('innerHTML') to clearly indicate it retrieves HTML markup rather than text or other formats, distinguishing it from siblings like 'pilot_page_text'. However, it could more explicitly differentiate from visual snapshot tools.

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?

While it explains the conditional behavior (full page when no ref provided), it lacks guidance on when to choose this tool over alternatives like 'pilot_page_text', 'pilot_snapshot', or 'pilot_element_state', leaving the agent without selection criteria.

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/TacosyHorchata/Pilot'

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