Skip to main content
Glama

Dom Query

dom_query

Queries page elements by CSS selector and returns attributes, optionally piercing shadow DOM and iframes. Use it to extract structured element data from a browser tab.

Instructions

querySelectorAll → element list w/ attrs (href/data-*/src/rect). pierce walks shadow + iframes. Columnar-compressed.

Ex: dom_query('t0', 'a.btn', 5) → {"_untrusted":true,"elements":{"_columnar":true,"keys":["tag","href","rect"],...}}

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": {
      "tab_id": "<tab_id>",
      "selector": "<selector>"
    },
    "name": "dom_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
pierceNo
tab_idYes
selectorYes
max_resultsNo
force_refreshNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.2/5.0
Behavior3/5

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

No annotations are supplied, so the description carries the full burden; it does add real behavioral context the schema lacks (pierce traverses shadow DOM and iframes, output is columnar-compressed, results carry an _untrusted flag). It omits any statement of read-only safety, whether it executes page scripts, or what max_results truncation means. It also presents a positional example (tab_id, selector, max_results) that does not match the schema's property ordering (pierce first), which could mislead.

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?

Terse and front-loaded: purpose first, then the one non-obvious flag, then a return-shape example. The heavy abbreviation ('w/', 'attrs', 'Columnar-compressed') costs some readability for an agent parsing it cold, but nothing is padded.

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

Completeness3/5

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

An output schema exists, so return values need not be explained, and the example partly covers shape. For a five-parameter tool with zero schema coverage, however, force_refresh's meaning and the tab_id format are unaddressed, leaving an agent to guess on two of five inputs.

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 0% with five parameters, so the description must compensate. It explains pierce (shadow + iframe traversal) and demonstrates tab_id, selector, and max_results in the example, but force_refresh is never mentioned and selector's expected CSS syntax is only implied by the name querySelectorAll.

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?

States a specific mechanism and resource: querySelectorAll over the DOM, returning an element list with chosen attributes (href/data-*/src/rect). This is concrete enough to distinguish it from extract_text/extract_links/aria_snapshot, though it never names those siblings or says which to prefer for text vs. attribute extraction.

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 explicit when-to-use or when-not guidance, and no routing to alternatives like find_by_text, inspect_element, or aria_snapshot. The code example demonstrates a call shape but not the conditions that select this tool over its many DOM-related siblings.

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