Skip to main content
Glama

query_dom

Read-onlyIdempotent

Query DOM elements by CSS selector to return structure, attributes, bounding rectangles, and computed styles for inspecting page content and layout.

Instructions

Query DOM elements by CSS selector, returning structure, attributes, bounding rect and, with properties, computed styles. Use it when you already have a selector (no match: count 0); to find one, get_interactives or find_text; for the rule that set a style, get_css_styles.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMax elements returned, from the top of the match list
tab_idNoTarget tab; omitted = last tab navigated in this session, else the active one
frame_idNoTarget iframe id from get_frames; omitted = main frame
selectorYesCSS selector; ">>>" pierces shadow DOM. Matches all, not just the first
propertiesNoComputed styles to include, e.g. ["color"]

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv1.10.0
    • addedInput schema / properties / frame_id / description
      Added value: +"Target iframe id from get_frames; omitted = main frame"
    • addedInput schema / properties / limit / description
      Added value: +"Max elements returned, from the top of the match list"
    • addedInput schema / properties / selector / description
      Added value: +"CSS selector; \">>>\" pierces shadow DOM. Matches all, not just the first"
    • addedInput schema / properties / tab_id / description
      Added value: +"Target tab; omitted = last tab navigated in this session, else the active one"
  2. First observedv1.8.0

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint and destructiveHint=false, so the safety profile is covered; the description adds that a non-matching selector yields count 0 and that computed styles are opt-in via properties. It stops short of describing result shape beyond the field list or pagination/truncation behavior relative to limit.

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?

Two sentences, zero filler; the capability statement comes first and the disambiguation clause follows. Every clause carries information an agent needs to choose or call the tool.

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?

With no output schema, the description carries the return-value burden and does so (structure, attributes, bounding rect, computed styles). Combined with 100% parameter coverage and read-only annotations, nothing essential for correct invocation is missing.

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 limit, tab_id, frame_id, selector and properties are all documented in the schema, including the '>>>' shadow-DOM syntax and the default tab fallback. The description only echoes the properties/computed-styles relationship, adding little beyond the schema baseline.

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 (query) and resource (DOM elements) plus the return payload (structure, attributes, bounding rect, optional computed styles). It explicitly distinguishes itself from get_interactives, find_text and get_css_styles, so an agent can route correctly 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 Guidelines5/5

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

Gives an explicit precondition ('when you already have a selector'), names the alternatives for the adjacent tasks (get_interactives, find_text for discovery; get_css_styles for style provenance), and notes the empty-result case. Both when-to-use and when-to-use-something-else are covered.

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