Skip to main content
Glama

get_page_content

Extract HTML content from web pages for automation tasks using Playwright browser control.

Instructions

Get the current page HTML content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
page_idNo

Implementation Reference

  • Handler for the 'get_page_content' tool: retrieves the active page and returns its HTML content using Playwright's page.content() method.
    elif name == "get_page_content":
        page = get_active_page(arguments.get("page_id"))
        content = await page.content()
        return [types.TextContent(type="text", text=content)]
  • Registers the 'get_page_content' tool in the list_tools() function, including its name, description, and input schema.
    types.Tool(
        name="get_page_content",
        description="Get the current page HTML content",
        inputSchema={
            "type": "object",
            "properties": {
                "page_id": {"type": "string"},
            },
        },
    ),
  • Defines the input schema for 'get_page_content' tool: optional page_id string.
    types.Tool(
        name="get_page_content",
        description="Get the current page HTML content",
        inputSchema={
            "type": "object",
            "properties": {
                "page_id": {"type": "string"},
            },
        },
    ),
  • Helper function used by the handler to retrieve the page instance based on page_id or current default.
    def get_active_page(page_id: Optional[str] = None) -> Page:
        """Get the active page based on page_id or current default."""
        global current_page_id
        
        if page_id is None:
            page_id = current_page_id
        
        if page_id not in pages:
            raise ValueError(f"Page not found: {page_id}")
        
        return pages[page_id]
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. While 'Get' implies a read operation, it doesn't specify whether this requires a page to be fully loaded, if it works with dynamic content, what happens with authentication-protected pages, or potential rate limits. The description mentions 'current page' but doesn't clarify if this refers to the active browser tab or requires explicit navigation first.

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 at just 6 words, front-loading the core functionality without any wasted words. Every word contributes directly to understanding what the tool does. The structure is optimal for a simple tool description, though this conciseness comes at the cost of missing important contextual information.

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 complexity of browser automation tools, no annotations, no output schema, and incomplete parameter documentation, the description is insufficient. It doesn't explain what format the HTML content returns in, whether it includes external resources, how it handles JavaScript-rendered content, or error conditions. For a tool that interacts with browser pages, this leaves too many operational questions unanswered.

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?

With 0% schema description coverage and one parameter ('page_id'), the description provides no information about what this parameter means, what format it expects, or whether it's required. The description mentions 'current page' which might imply no parameter is needed, but the schema shows a 'page_id' property. This creates ambiguity about whether the tool works on the current page or requires explicit page identification.

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 action ('Get') and resource ('current page HTML content'), making the purpose immediately understandable. It distinguishes itself from siblings like 'get_text' (which likely extracts text) and 'take_screenshot' (which captures visual content) by specifying HTML content retrieval. However, it doesn't explicitly mention that it fetches from a browser context, which could be inferred from sibling tools but isn't stated directly.

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 specify if this should be used instead of 'get_text' for raw HTML, whether it requires a page to be loaded first, or if it works with any page state. With multiple sibling tools for page interaction, this lack of comparative context leaves the agent guessing about appropriate usage scenarios.

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/misanthropic-ai/playwrite-mcp'

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