Skip to main content
Glama

query_dom

Read-onlyIdempotent

Query DOM elements using CSS selectors or XPath expressions to retrieve tag, attributes, text, and position. Supports pagination and shadow DOM piercing.

Instructions

Query DOM elements via CSS selector or XPath. Returns tag, attributes, text, position. CSS results include a ref field for use in subsequent calls.

When to use: Precise element lookup by CSS selector or XPath when you know the exact selector. When NOT to use: Use find for natural-language element search or read_page for full DOM structure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tabIdYesTab ID to query
methodYesQuery method: css or xpath
selectorNo(css) CSS selector
xpathNo(xpath) XPath expression
multipleNoReturn all matches. Default: false
pierceShadowNoSearch inside shadow DOM when no results in light DOM. Default: true
limitNo(multiple) Max results per page. Defaults to 50 for CSS/XPath.
cursorNoOpaque pagination cursor returned as nextCursor from a prior query_dom multiple-result call.
Behavior4/5

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

Annotations indicate readOnlyHint=true, destructiveHint=false, idempotentHint=true. Description adds context about ref field for chaining and implies pagination via cursor/limit, consistent with annotations. No contradictions.

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?

Three sentences: first defines functionality, second lists return values, third provides usage guidance. Every sentence is essential and well-placed.

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?

Given 8 parameters with full schema coverage and annotations, the description adds usage context and output details (ref field). Could mention pagination behavior more explicitly, but sufficient for typical use.

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 coverage is 100% with good descriptions for each parameter. The description adds minimal extra semantics beyond what the schema provides (e.g., ref field mention but not a parameter). Baseline 3 is appropriate.

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 clearly states it queries DOM elements via CSS selector or XPath, returns specific data (tag, attributes, text, position), and notes a ref field. This distinguishes it from siblings like find and read_page.

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

Usage Guidelines5/5

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

Explicitly states when to use (precise element lookup by exact selector) and when NOT to use (use find for natural-language or read_page for full DOM). Provides clear alternatives.

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/shaun0927/openchrome'

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