Skip to main content
Glama

watch_dom

Destructive

Observe DOM mutations under a selector to see what an action changed. Install a MutationObserver, then return added/removed nodes or attribute updates; clear the buffer or stop it.

Instructions

Watch DOM mutations (MutationObserver) under selector, to see what an action changed. First call installs the watcher in the page; later calls return the latest mutations (type, tag, attribute, nodes added/removed), clear deletes the ones returned, stop disconnects and empties the buffer. To wait for one element or text use wait_for.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stopNoDisconnect observer
clearNoClear buffer after read
limitNoMost recent mutations; buffer 1000
tab_idNoTarget tab; omitted = last tab navigated in this session, else the active one
subtreeNoObserve descendants too, not just the matched node
selectorNoSubtree to observe; ">>>" pierces shadow DOMbody
childListNoReport added and removed children
attributesNoReport attribute changes
characterDataNoReport text content changes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv1.10.0
    • addedInput schema / properties / attributes / description
      Added value: +"Report attribute changes"
    • addedInput schema / properties / characterData / description
      Added value: +"Report text content changes"
    • addedInput schema / properties / childList / description
      Added value: +"Report added and removed children"
    • addedInput schema / properties / selector / description
      Added value: +"Subtree to observe; \">>>\" pierces shadow DOM"
    • addedInput schema / properties / subtree / description
      Added value: +"Observe descendants too, not just the matched node"
    • 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.6/5.0
Behavior5/5

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

Goes well beyond the annotations by disclosing the full lifecycle: install-on-first-call, buffer read-back, clear deleting returned mutations, and stop disconnecting plus emptying the buffer. This directly explains the destructiveHint=true semantics that the annotation only flags abstractly, and it names what is returned (type, tag, attribute, added/removed nodes).

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 front-loaded sentences: purpose, then the stateful workflow and destruction semantics, then the alternative tool. No filler, and the most decision-relevant routing info sits at the end where it is easy to scan.

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?

For a 9-parameter stateful tool with no output schema, the description covers the lifecycle, return contents, and alternative routing adequately. It omits the buffer/limit interaction (1000 vs default 100) and the shadow-DOM piercing syntax, though those live in the schema.

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?

Schema coverage is 100%, so the baseline is 3, but the description adds real meaning for clear ('deletes the ones returned') and stop ('disconnects and empties the buffer') that sharpens the terse schema text. The observer flags (childList, attributes, characterData, subtree) are left entirely to the 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?

States a specific verb (Watch), resource (DOM mutations via MutationObserver), and scope (under selector), plus the intent ('to see what an action changed'). It is clearly distinguishable from siblings like query_dom, track_events, and wait_for 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 Guidelines4/5

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

Explains the stateful call pattern (first call installs, later calls read) and routes the agent to wait_for for single-element/text waiting. It does not, however, differentiate from adjacent siblings like track_events or monitor_network that also observe page activity, so the exclusion set is incomplete.

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