Skip to main content
Glama

suggestSelectors

Suggests testing-library selectors for a DOM element, prioritizing accessible role, label, text, placeholder, and test ID queries to create maintainable tests.

Instructions

Suggest testing-library selectors for a DOM element. Prioritizes accessible selectors (role > label > text > placeholder > testid).

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": {
      "tagName": "<tagName>"
    },
    "name": "suggestSelectors"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameNoThe name attribute (for form elements)
roleNoThe ARIA role attribute
testIdNoThe data-testid attribute
tagNameYesThe HTML tag name (e.g., "button", "input", "div")
ariaLabelNoThe aria-label attribute
placeholderNoThe placeholder attribute (for inputs)
textContentNoVisible text content inside the element

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It does disclose a genuine behavioral trait — output is ranked with an explicit precedence (role > label > text > placeholder > testid) — but it says nothing about the shape of the result (a single string vs. a ranked list), whether it can fail, or whether it is a pure read-only computation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, zero filler, with the purpose front-loaded and the ranking rule immediately after. Every clause carries information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With seven parameters, no output schema, and no annotations, the description is thin on the return side — the agent cannot tell what it gets back or in what form. The input side is fully covered by the schema plus the precedence hint, so the gap is narrow but real.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3, and the description earns an increment: the precedence chain maps directly onto the optional inputs (role, ariaLabel, textContent, placeholder, testId) and tells the agent which fields produce higher-quality selectors, information the schema does not convey.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: "Suggest testing-library selectors for a DOM element." The siblings (generateMocksFromNetwork, generateTestFromRecording) produce mocks and tests rather than selector suggestions, so the resource distinction is discernible, but the description never names an alternative explicitly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is only implied: an agent must infer it should call this when it has DOM element attributes and needs a selector. There is no when-not-to-use guidance and no mention of the sibling tools or how this differs from generating a test from a recording.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.