Problem
When using element_tool with getAllElements, the only option is query: "all" which returns every element on the page. On complex pages, this leads to:
- Massive token counts (even with
includeAllBreakpointStyles: false)
- Hitting the 25k token truncation limit
- Slow responses
Proposed Solution
Add filtering options to getAllElements, for example:
{
"getAllElements": {
"query": {
"type": "div", // Filter by element type
"className": "hero", // Filter by class name
"parentId": "abc123", // Get children of specific element
"limit": 50 // Limit number of results
}
}
}
Or alternatively, a separate action like getElementByClassName or getElementsByType.
Current Workaround
Using selectElement → getSelectedElement for specific elements, but this requires knowing the element ID beforehand.
Thanks for the great MCP server! 🙏
Problem
When using
element_toolwithgetAllElements, the only option isquery: "all"which returns every element on the page. On complex pages, this leads to:includeAllBreakpointStyles: false)Proposed Solution
Add filtering options to
getAllElements, for example:{ "getAllElements": { "query": { "type": "div", // Filter by element type "className": "hero", // Filter by class name "parentId": "abc123", // Get children of specific element "limit": 50 // Limit number of results } } }Or alternatively, a separate action like
getElementByClassNameorgetElementsByType.Current Workaround
Using
selectElement→getSelectedElementfor specific elements, but this requires knowing the element ID beforehand.Thanks for the great MCP server! 🙏