rescan_elements
Rescan UI elements on a web page after content changes like navigation or DOM updates to maintain accurate annotations.
Instructions
Force the annotated page to rescan all UI elements. Use this after the page content has changed (e.g. after navigation, DOM updates, or user interaction).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.js:118-133 (handler)The handler for the 'rescan_elements' tool, which triggers a rescan command via the proxy and waits for elements to be updated.
mcp.tool( 'rescan_elements', 'Force the annotated page to rescan all UI elements. Use this after the page content has changed (e.g. after navigation, DOM updates, or user interaction).', {}, async () => { proxy.rescan(); // Wait a moment for the scan to complete await new Promise(r => setTimeout(r, 500)); const count = proxy.getElements().length; return { content: [{ type: 'text', text: `Rescanned page. Found ${count} elements.`, }], }; } - src/proxy.js:178-178 (helper)The implementation of the rescan action, which adds a 'scan' command to the pending commands queue for the browser to execute.
rescan: () => { pendingCommands.push({ type: 'scan' }); },