Skip to main content
Glama

Read the DOM tree of a page through DevTools

browser_dom_tree
Read-only

Walk a real DOM tree via the DevTools inspector walker to return a bounded outline, giving a structured alternative to raw page HTML for large pages.

Instructions

Walk a real DOM tree through the DevTools inspector walker and return a bounded outline. MEASURED: the path is CommandsFactory.forTab -> targetCommand.startListening -> target.getFront("inspector") -> inspector.getWalker() -> walker.getRootNode(), and the root reports nodeName "#document" with numChildren. This is the structured counterpart to browser_page_source (which returns raw HTML text) and is far cheaper for large pages.

Input Schema

NameRequiredDescriptionDefault
contextNoTab URL fragment or context id (default: active tab)
maxDepthNoHow deep to walk (default 4)
maxNodesNoNode budget (default 120)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, so the safety profile is covered. The description adds real context beyond that: the walk is bounded by depth/node budgets, the root is '#document' with numChildren, and the underlying inspector walker is disclosed, giving confidence about what the call actually does. It stops short of describing node payload fields or truncation behavior when budgets are hit.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with the action and the output shape, then the sibling contrast. The 'MEASURED: ... -> ... -> ...' call chain is somewhat implementation trivia that consumes space, but it is compact and does convey the mechanism.

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

Completeness4/5

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

There is no output schema, and the description conveys the essential return shape (outline rooted at #document with numChildren) and that it is budget-limited. It does not explain the node record fields or what happens on truncation, which is the main remaining gap for a tool with no output schema.

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%, so context, maxDepth and maxNodes are already fully documented with defaults and ranges in the schema. The description only reinforces the notion of a 'bounded outline' without adding per-parameter semantics, so baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb ('Walk a real DOM tree through the DevTools inspector walker') and a specific output ('bounded outline'), and explicitly contrasts itself with sibling browser_page_source. An agent can distinguish this from browser_page_source or browser_a11y_tree without opening any schema.

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

Usage Guidelines4/5

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

Names the alternative browser_page_source and the condition that favors this tool ('far cheaper for large pages'). It does not address other plausible alternatives such as browser_evaluate or browser_a11y_tree, so it stops short of full exclusion guidance, but the context is clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools