observe
Watch an element for text or attribute changes and wait until a specified condition to trigger a click, replacing manual MutationObserver or polling code.
Instructions
Watch an element for changes instead of polling with MutationObserver/setInterval code in evaluate. collect: record text/attribute changes for 'duration' ms. until: wait for a condition, then optionally click at once (then_click). click_first fires the triggering action after the observer is armed, so nothing is missed.
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": {
"selector": "<selector>"
},
"name": "observe"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| until | No | JS expression checked on each change, 'el' is the element, e.g. el.textContent === '8' | |
| collect | No | text (textContent) | attributes | all | text |
| timeout | No | Max observation time in ms (max 25000) | |
| duration | No | Collect window in ms (default 5000); exclusive with until | |
| interval | No | Polling fallback interval in ms | |
| selector | Yes | CSS selector or ref of the element to observe | |
| then_click | No | Selector or ref to click immediately when until holds | |
| click_first | No | Selector or ref to click once the observer is armed |