Skip to main content
Glama

get_dom_tree

Fetch the page's DOM tree as JSON, including element IDs, tags, classes, roles, visibility, and bounds, to obtain element IDs for use with other tools.

Instructions

Get the DOM tree of the page as JSON. Each element has: id, tag, html_id, class, role, text, visible, bounds, children. Use element IDs from this tree in other tools.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

No annotations are provided, so the description carries the full burden. It clearly discloses the return format and the per-element structure (id, tag, html_id, class, role, text, visible, bounds, children), indicating a pure read operation. It could add more details about dynamic content or performance, but it adequately describes the behavior.

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 two concise sentences, front-loaded with the main purpose, then detailing the output structure and usage instruction. Every sentence adds value without redundancy.

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

Completeness5/5

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

Given the tool's simplicity (no parameters, output schema present), the description fully explains what the DOM tree contains and how to utilize it (element IDs for other tools). It provides sufficient context for an agent to decide when to invoke it.

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

Parameters4/5

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

The tool has zero parameters, so no parameter explanation is needed. The baseline for 0 parameters is 4, and the description appropriately focuses on the output structure rather than parameter semantics, which is consistent with the empty input schema.

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?

The description uses a specific verb 'Get' with a clear resource 'DOM tree of the page as JSON.' It distinguishes itself from sibling actions like click or type_text by clearly indicating it is a read/introspection tool.

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?

The description states 'Use element IDs from this tree in other tools,' providing clear context for when to call it. It does not explicitly mention alternatives or exclusions, but the instruction implies its role as a prerequisite for other tools.

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/com55/pywebview-mcp'

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