Skip to main content
Glama

Suggest Resilient Locator Fixes

suggest_locator_fixes
Read-onlyIdempotent

Analyze a failing Playwright selector against recorded trace DOM state and return advisory JSON with getByRole, getByTestId, and auto-await recommendations without editing test files.

Instructions

Analyzes a failing Playwright selector from a trace.zip (or customSelector, e.g. "button#pay") against recorded DOM state and returns advisory JSON { failingSelector, failureClassification, recommendations } (getByRole, getByTestId, auto-await) without editing test files. Defaults to the latest trace under cwd if tracePath is omitted; returns an error if no trace exists, or undefined failingSelector with general recommendations if no action failed. Use when you only need selector replacements; prefer triage_failure for full failure diagnosis or non-selector failures.

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": "suggest_locator_fixes"
  }
}

Input Schema

NameRequiredDescriptionDefault
tracePathNoAbsolute or relative path to trace.zip (e.g. test-results/checkout/trace.zip). If omitted, uses the latest trace in the workspace.
customSelectorNoOptional Playwright selector string (e.g. "button#submit" or "text=Pay") to report as failingSelector instead of the trace action selector.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.0.1
    • changedInput schema / properties / customSelector / description
      Previous value: -"Optional custom selector to evaluate instead of the failing selector recorded in the trace."New value: +"Optional Playwright selector string (e.g. \"button#submit\" or \"text=Pay\") to report as failingSelector instead of the trace action selector."
    • changedInput schema / properties / tracePath / description
      Previous value: -"Absolute or relative path to trace.zip. If omitted, uses the latest trace in the workspace."New value: +"Absolute or relative path to trace.zip (e.g. test-results/checkout/trace.zip). If omitted, uses the latest trace in the workspace."
  2. Changed2 schema fields changedv1.0.0
    • changedInput schema / properties / customSelector / description
      Previous value: -"Optional custom selector to evaluate if different from the failing trace action."New value: +"Optional custom selector to evaluate instead of the failing selector recorded in the trace."
    • changedInput schema / properties / tracePath / description
      Previous value: -"Path to trace.zip. If omitted, uses latest trace."New value: +"Absolute or relative path to trace.zip. If omitted, uses the latest trace in the workspace."
  3. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

Beyond the readOnly/idempotent/non-destructive annotations, it discloses that no test files are edited, that tracePath defaults to the latest trace under cwd, and the two failure modes (error when no trace exists, undefined failingSelector with general recommendations when no action failed). That is meaningful behavioral context the annotations do not cover.

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

Conciseness4/5

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

It is front-loaded with the core action and return shape, and every clause carries information. The sentence is dense with parentheticals and a semicolon chain, which slightly hurts scanability but does not waste words.

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

Completeness5/5

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

Although there is no output schema, the description enumerates the returned JSON keys and the edge-case return values, and it covers both optional parameters' defaults. Nothing an agent needs in order to call this correctly is missing.

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 the baseline is 3, but the description adds the semantics of the customSelector override (it becomes the reported failingSelector instead of the trace action selector) and reinforces the tracePath default-and-error behavior. It stops short of format examples beyond the one inline selector sample, so it is not a full 5.

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

Purpose5/5

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

The description states a specific verb and resource — analyzing a failing Playwright selector against recorded DOM state — and names the exact return payload fields (failingSelector, failureClassification, recommendations). It explicitly carves out scope against triage_failure, so the agent can distinguish the two without inspecting schemas.

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

Usage Guidelines5/5

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

It gives explicit when-to-use guidance ('Use when you only need selector replacements') and an explicit when-not plus named alternative ('prefer triage_failure for full failure diagnosis or non-selector failures'). Nothing about tool selection is left to inference.

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