Skip to main content
Glama

get_dom

Extract complete HTML content from the current page DOM for web development debugging and analysis. Use this tool to inspect page structure and retrieve formatted HTML output.

Instructions

Extrai o HTML completo do DOM atual da página

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
prettifyNoSe true, formata o HTML de forma legível

Implementation Reference

  • Handler function that implements the core logic of the 'get_dom' tool: fetches page HTML, optionally prettifies it, and returns as MCP ToolResponse.
    export async function handleGetDom(args: unknown, currentPage: Page): Promise<ToolResponse> {
      const typedArgs = args as unknown as GetDomArgs;
      const { prettify = true } = typedArgs;
    
      let html = await currentPage.content();
    
      if (prettify) {
        html = await currentPage.evaluate(() => {
          const div = document.createElement('div');
          div.innerHTML = document.documentElement.outerHTML;
          return div.innerHTML;
        });
      }
    
      return {
        content: [
          {
            type: 'text',
            text: html,
          },
        ],
      };
  • TypeScript interface defining the input schema for get_dom tool arguments.
    export interface GetDomArgs {
      prettify?: boolean;
    }
  • src/tools.ts:27-40 (registration)
    Tool registration entry in the tools array, including name, description, and JSON schema for input validation used by MCP listTools.
    {
      name: 'get_dom',
      description: 'Extrai o HTML completo do DOM atual da página',
      inputSchema: {
        type: 'object',
        properties: {
          prettify: {
            type: 'boolean',
            description: 'Se true, formata o HTML de forma legível',
            default: true,
          },
        },
      },
    },
  • src/index.ts:71-74 (registration)
    Dispatch case in the main tool call handler that routes 'get_dom' calls to the handleGetDom function.
    case 'get_dom': {
      const currentPage = await initBrowser();
      return await handleGetDom(args, currentPage);
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool does (extracts full HTML) but doesn't describe important behaviors: whether this is a read-only operation, potential performance impact on large DOMs, if it waits for page load, or what format the output returns. The description adds minimal context beyond the basic action.

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 a single, efficient sentence that directly states the tool's purpose with zero wasted words. It's appropriately sized for a simple extraction tool and front-loads the core functionality immediately.

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?

For a tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the output looks like (e.g., string of HTML), doesn't mention behavioral constraints, and provides minimal context about when this extraction is appropriate versus other DOM tools. Given the sibling tools available, more guidance would be helpful.

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 100% with one parameter fully documented in the schema. The description doesn't mention any parameters or add meaning beyond what the schema provides about 'prettify'. Since the schema does the heavy lifting, the baseline score of 3 is appropriate.

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's purpose with a specific verb ('Extrai' meaning 'Extracts') and resource ('HTML completo do DOM atual da página' meaning 'full HTML of the current page DOM'). It distinguishes from siblings like get_page_source (which might return server-side HTML) by specifying 'DOM atual' (current DOM), but doesn't explicitly differentiate from all possible alternatives.

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 like get_page_source or execute_js for DOM extraction. It doesn't mention prerequisites (e.g., requires a page to be loaded) or exclusions. Usage is implied by the purpose statement alone.

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/EmmanuelBarbosaMonteiro/mcp-server-browser'

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