Skip to main content
Glama

Capture locator baselines

capture_baseline

Records an element fingerprint for each locator while tests pass, so heal_locator can restore broken locators after UI changes. Supports logged-in pages via saved sessions.

Instructions

While tests pass, record a fingerprint (role, name, test id, id, classes, text...) of the element each locator matches, saved in .qa-mcp/baselines.json under the page reached. heal_locator uses these after the UI changes. Accepts the same session as explore_page for pages behind a login.

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": {
      "url": "<url>",
      "locators": "<locators>"
    },
    "name": "capture_baseline"
  }
}

Input Schema

NameRequiredDescriptionDefault
urlYes
deviceNoEmulate a device for mobile web: a Playwright device name such as "iPhone 15" or "Pixel 7" (list_devices), or "desktop" (default)
sessionNoReach pages behind a login or several steps into a flow
locatorsYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.3.0
    • addedInput schema / properties / device
      Added value: +{
      +  "description": "Emulate a device for mobile web: a Playwright device name such as \"iPhone 15\" or \"Pixel 7\" (list_devices), or \"desktop\" (default)",
      +  "type": "string"
      +}
  2. First observedv0.2.1

TDQS

A3.9/5.0
Behavior3/5

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

With no annotations, the description carries the full burden and does disclose meaningful behavior: a write to .qa-mcp/baselines.json, per-page keying, the fingerprint fields captured, and that a login session can be supplied. It omits important traits for a mutating capture tool — what happens when a locator matches nothing or many elements, whether existing baselines are overwritten, and what is returned.

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?

Three sentences, front-loaded with the core action and storage location, then the downstream consumer, then the auth note. The parenthetical fingerprint field list is bulky but informative; nothing else is wasted.

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

Completeness4/5

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

For a 4-parameter tool with a nested session object, no output schema, and no annotations, the description covers purpose, storage, consumer, and auth path well. The main shortfall is failure/overwrite semantics and return behavior, which the agent would need before capturing across an existing baseline set.

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

Parameters3/5

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

Schema description coverage is 50%: device is already well documented in the schema, and the description adds meaning for locators (fingerprint of matched elements, with field examples) and session (same session as explore_page, for pages behind a login). The url parameter is undocumented in both the schema and the description, so compensation for the coverage gap is partial.

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?

States a specific verb and resource: record a fingerprint of the element each locator matches, persisted to .qa-mcp/baselines.json, keyed by the page reached. It also names heal_locator as the downstream consumer, so the agent can distinguish this from the healing sibling without opening the schema.

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

Usage Guidelines4/5

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

Gives a real precondition ("While tests pass") that tells the agent exactly when to run this, and explains the downstream workflow (heal_locator uses these after the UI changes). It does not explicitly exclude alternatives such as check_locator or say what to do if a baseline already exists, so it stops short of full when/when-not guidance.

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