Skip to content

Feature Request: Add filtering options to getAllElements query #72

@dulemin

Description

@dulemin

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 selectElementgetSelectedElement for specific elements, but this requires knowing the element ID beforehand.


Thanks for the great MCP server! 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions