Skip to main content
Glama

get_page_content

Extract the HTML content of a webpage using Playwright MCP. Submit the page ID to retrieve the full HTML structure for automation or analysis tasks.

Instructions

Get the current page HTML content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
page_idNo

Implementation Reference

  • Handler logic for 'get_page_content' tool: retrieves the active page and returns its HTML content using page.content().
    elif name == "get_page_content": page = get_active_page(arguments.get("page_id")) content = await page.content() return [types.TextContent(type="text", text=content)]
  • Registration of the 'get_page_content' tool in the list_tools handler, including its 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"}, }, }, ), types.Tool(
  • Helper function used by get_page_content to retrieve the active browser page 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]

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

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