query_dom
Fetch DOM elements by CSS selector or XPath. Returns tag, attributes, text, position, and a ref field for CSS results.
Instructions
Query DOM elements via CSS selector or XPath. Returns tag, attributes, text, position. CSS results include a ref field for use in subsequent calls.
When to use: Precise element lookup by CSS selector or XPath when you know the exact selector. When NOT to use: Use find for natural-language element search or read_page for full DOM structure.
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": {
"tabId": "<tabId>",
"method": "<method>"
},
"name": "query_dom"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | (multiple) Max results per page. Defaults to 50 for CSS/XPath. | |
| tabId | Yes | Tab ID to query | |
| xpath | No | (xpath) XPath expression | |
| cursor | No | Opaque pagination cursor returned as nextCursor from a prior query_dom multiple-result call. | |
| method | Yes | Query method: css or xpath | |
| multiple | No | Return all matches. Default: false | |
| selector | No | (css) CSS selector | |
| pierceShadow | No | Search inside shadow DOM when no results in light DOM. Default: true |