Skip to main content
Glama

browser.get_html

Extract HTML source or plain text from web pages. Configure to capture full pages or visible viewport content for automation tasks.

Instructions

Get the HTML source of the current page. Set text_only=true to strip tags and return plain text. Set full_page=false (default) for visible viewport only.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idYes
full_pageNo
text_onlyNo

Implementation Reference

  • The _get_html method in McpToolGateway is the implementation handler for the browser.get_html tool.
    async def _get_html(self, payload: GetPageHtmlInput) -> dict[str, Any]:
        session = await self.manager.get_session(payload.session_id)
        if payload.text_only:
            text = await session.page.evaluate(
                "() => document.body ? document.body.innerText : ''"
            )
            return {"session_id": payload.session_id, "content": text, "type": "text"}
        html = await session.page.content()
        return {"session_id": payload.session_id, "content": html, "type": "html"}
  • Registration of browser.get_html tool within McpToolGateway._tools.
        name="browser.get_html",
        description=(
            "Get the HTML source of the current page. "
            "Set text_only=true to strip tags and return plain text. "
            "Set full_page=false (default) for visible viewport only."
        ),
        input_model=GetPageHtmlInput,
        handler=self._get_html,
    ),
  • Input schema definition for browser.get_html tool.
    class GetPageHtmlInput(SessionIdInput):
        full_page: bool = False
        text_only: bool = False
Behavior3/5

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

With no annotations provided, the description carries the full burden. It successfully explains the behavioral differences between viewport-only and full-page capture, and text stripping. However, it omits safety characteristics (read-only status), return format details, and error conditions that annotations would typically cover.

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 excellently structured with three efficient sentences: one for core purpose, two for parameter semantics. Every sentence earns its place with no redundancy or unnecessary elaboration.

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?

Given the 0% schema coverage and lack of annotations/output schema, the description adequately covers the tool's core functionality and two key boolean parameters. However, it is incomplete regarding the required `session_id` and provides no indication of the return value structure (string vs. object).

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

Parameters3/5

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

Schema description coverage is 0%, requiring the description to compensate. It successfully explains `text_only` (strips tags, returns plain text) and `full_page` (viewport scope with default noted), but completely omits explanation of the required `session_id` parameter, leaving a significant gap.

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 retrieves 'HTML source of the current page' with a specific verb and resource. However, it could better distinguish from sibling `browser.observe` (which likely returns accessibility tree/DOM structure) by explicitly mentioning 'raw HTML source code'.

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

Usage Guidelines3/5

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

The description provides clear parameter-level guidance on when to use `text_only` (to strip tags) and `full_page` (viewport vs. full document). However, it lacks cross-tool guidance on when to choose this over `browser.observe`, `browser.screenshot`, or `browser.eval_js` for page content extraction.

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/LvcidPsyche/auto-browser'

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