Skip to main content
Glama
Playwright DevTools MCP Server

Playwright DevTools MCP Server

by ariangibson

debug_get_dom_tree

Retrieves a structured DOM tree from a browser context for analysis, with optional CSS selector, depth limit, text, and attributes to inspect page structure and debug UI issues.

Instructions

Get a structured representation of the DOM tree for analysis

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "contextId": "<contextId>"
    },
    "name": "debug_get_dom_tree"
  }
}

Input Schema

NameRequiredDescriptionDefault
maxDepthNoMaximum depth to traverse in the DOM tree
selectorNoCSS selector to start traversal from (default: html)
contextIdYesBrowser context ID from browser_launch
includeTextNoInclude text content of elements
includeAttributesNoInclude element attributes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

C2.9/5.0
Behavior2/5

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

No annotations are supplied, so the description carries the full disclosure burden and largely drops it. It never says what the 'structured representation' actually contains (nodes, nesting, serialization format), whether output can be truncated or is expensive on large pages, or whether the call is purely read-only — all of which matter for a 5-parameter debug tool.

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?

A single short sentence, front-loaded with the verb and resource. It is efficient, though the closing phrase 'for analysis' is filler that could be replaced with substantive detail.

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?

With no output schema and no annotations on a five-parameter tool, the description must explain the return value and its limits, and it does not. An agent cannot tell what the 'structured representation' looks like, how large it may be, or how it differs from page source output, which is a significant gap for a debugging tool.

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 every parameter (maxDepth, selector, contextId, includeText, includeAttributes) is already documented in the schema. The description adds no meaning beyond that, such as how maxDepth interacts with truncation or what selector defaulting to html implies, so the baseline of 3 applies.

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 states a specific verb and resource: getting a structured DOM tree representation. That is enough for an agent to know the general operation, but it never distinguishes this tool from close siblings such as debug_get_page_source (raw HTML) or debug_get_element_properties, leaving the boundary between them unstated.

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?

There is no when-to-use guidance at all: no conditions favoring this over debug_get_page_source or debug_get_element_properties, no prerequisites beyond what the schema implies, and no note on when the tool is inappropriate. The trailing phrase 'for analysis' is too vague to count as usage direction.

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