get_selected_elements
Retrieves DOM elements a user visually selected in the browser, returning stable tiered selectors, element context, and comments for precise script targeting.
Instructions
Get DOM elements that the user has visually selected in the browser for a specific script. Returns each selection's stable, tiered selectors, element context, and user comments. Returns the selections in this response, so it needs no filesystem access. WRITES FILES only when you pass writeFiles: true, which saves .dom.md context files under the directory you name. Use CM_findElement with the domId for precise targeting in scripts. When MCP is connected, .dom.md context files and screenshots are automatically pushed to the workspace (.customaise/dom-context//) in real-time as the user selects elements. Use this tool to retrieve selections if the auto-pushed files are missing or to get the raw JSON data.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_selected_elements"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scriptId | No | Script ID to get selections for. Omit to get all scripts' selections. | |
| directory | No | Workspace directory for .dom.md files. Required if writeFiles is true. | |
| writeFiles | No | If true, writes .dom.md context files to the workspace directory. Default: false. |