Skip to main content
Glama

browser_locate

Locate a DOM element by CSS selector and return its screen coordinates for mouse clicks; re-run if the page reflows to avoid stale positions.

Instructions

Find a DOM element by CSS selector and return its physical screen coordinates — compatible directly with mouse_click. Prefer browser_click to find+click in one step. Prefer browser_overview to discover selectors. Caveats: Coordinates are captured at call time; if the page reflows before mouse_click, coords may be stale. Typed errors: code:'BrowserNotConnected' (call browser_open first), code:'ElementNotFound' (selector did not match — re-discover via browser_overview / browser_search).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
portNoChrome/Edge CDP remote debugging port (default 9222; configurable via desktop-touch-config.json)
tabIdNoTab ID from browser_open. Omit to use the first page tab.
includeNoOptional response-shape opt-in. `['envelope']` returns the self-documenting envelope (`_version` / `data` / `as_of` / `confidence`). `['raw']` forces raw shape (overrides DESKTOP_TOUCH_ENVELOPE=1 server default). Default behaviour is raw shape (compat with existing clients).
selectorYesCSS selector for the target element (e.g. '#submit', '.btn', 'button[type=submit]')
includeContextNoWhen true (default), append `activeTab` + `readyState` lines to the response. Set false to skip — saves ~150 tokens per call when chaining several browser_* calls in the same tab.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv2.3.1
    • addedInput schema / $schema
      Added value: +"http://json-schema.org/draft-07/schema#"
    • removedInput schema / additionalProperties
      Removed value: -false
    • changedInput schema / properties / includeContext / description
      Previous value: -"When true, append activeTab and readyState context to the response."New value: +"When true (default), append `activeTab` + `readyState` lines to the response. Set false to skip — saves ~150 tokens per call when chaining several browser_* calls in the same tab."
    • changedInput schema / properties / port / description
      Previous value: -"Chrome/Edge CDP remote debugging port."New value: +"Chrome/Edge CDP remote debugging port (default 9222; configurable via desktop-touch-config.json)"
    • changedInput schema / properties / selector / description
      Previous value: -"CSS selector for the target element (e.g. '#submit', '.btn', 'button[type=submit]')."New value: +"CSS selector for the target element (e.g. '#submit', '.btn', 'button[type=submit]')"
  2. Addedv1.12.0
  3. Removedv1.10.4
  4. Addedv1.9.2
  5. Removedv1.8.0
  6. Addedv1.6.0
  7. Removedv1.5.1
  8. Addedv1.5.0
  9. Removedv1.4.3
  10. Addedv1.4.2
  11. Removedv1.4.0
  12. Changed1 schema field changedv1.2.1
    • addedInput schema / properties / include
      Added value: +{
      +  "description": "Optional response-shape opt-in. `['envelope']` returns the self-documenting envelope (`_version` / `data` / `as_of` / `confidence`). `['raw']` forces raw shape (overrides DESKTOP_TOUCH_ENVELOPE=1 server default). Default behaviour is raw shape (compat with existing clients).",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
  13. Addedv1.0.3

TDQS

A4.7/5.0
Behavior5/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 and does so well: it discloses the staleness caveat (coords captured at call time, may go stale after reflow), the prerequisite (call browser_open on BrowserNotConnected), and two typed error codes with recovery paths. This is exactly the behavioral context a caller needs.

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?

Front-loaded with purpose and output, then alternatives, then caveats, then error codes. Every sentence carries actionable information; no filler.

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?

With no output schema and no annotations, the description still covers return shape (screen coordinates usable by mouse_click), prerequisites, failure modes, and recovery steps. Nothing needed to invoke it correctly is missing.

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 100% and the schema already documents all five parameters thoroughly (port default, tabId sourcing, include envelope/raw semantics, includeContext token-saving). The description adds no parameter-level detail beyond the schema, so the baseline 3 applies.

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 ('Find a DOM element by CSS selector') plus the exact output ('physical screen coordinates'). It also names the sibling relationships (compatible with mouse_click), so an agent can distinguish it from browser_click and browser_eval without opening 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?

Explicitly routes to alternatives: 'Prefer browser_click to find+click in one step' and 'Prefer browser_overview to discover selectors.' Both the general case and the discovery case are covered, with the selecting condition stated.

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