Skip to main content
Glama

Check locator

check_locator

Verify how many elements a Playwright locator matches on a page and whether it is visible, so you can confirm it targets exactly one element before writing tests.

Instructions

Check how many elements a Playwright locator matches on a page (1 = good) and whether the match is visible. Accepts the same session as explore_page.

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>",
      "locator": "<locator>"
    },
    "name": "check_locator"
  }
}

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)
devicesNoCheck on several devices at once, e.g. ["desktop", "iPhone 15", "Pixel 7"]
locatorYese.g. page.getByRole('button', { name: 'Sign in' })
sessionNoReach pages behind a login or several steps into a flow

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields 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"
      +}
    • addedInput schema / properties / devices
      Added value: +{
      +  "description": "Check on several devices at once, e.g. [\"desktop\", \"iPhone 15\", \"Pixel 7\"]",
      +  "items": {
      +    "type": "string"
      +  },
      +  "maxItems": 8,
      +  "type": "array"
      +}
  2. First observedv0.2.1

TDQS

A3.6/5.0
Behavior3/5

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

With no annotations, the description must carry the behavioral burden. It usefully discloses the two return signals (match count and visibility) and that the session object is shared with explore_page, but says nothing about error behavior on zero matches, cost of launching browsers across multiple devices, or authentication requirements.

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 tight sentences with the core check front-loaded and the session hint second. No wasted wording.

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 read-only check tool with a nested session parameter and no output schema, the description gives enough to call it correctly: what is measured and how to reattach an existing session. The device/devices interplay and failure modes are the remaining, minor gaps.

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 coverage is 80%, so the schema already documents url, device, devices, locator, and session. The description only adds that session is interoperable with explore_page; it does not clarify the device vs devices relationship or when url is ignored in favor of the session start URL.

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: counts how many elements a Playwright locator matches and reports visibility. This is clearly distinct from heal_locator and explore_page, though it does not name those siblings directly.

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?

The parenthetical '(1 = good)' implies the intended check before committing to a locator, and it points to explore_page for session setup. There is no explicit statement of when not to use it or how it differs from heal_locator.

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