Skip to main content
Glama

Get the screen coordinates of an element so a native click can target it

browser_element_screen_coords
Read-only

Return an element's on-screen pixel centre for native input drivers, so OS-level clicks and drags land on target when synthesised DOM events are ignored.

Instructions

Return the on-screen pixel centre of an element, for handing to a native input driver (Cua, SendInput). MEASURED: compute it as mozInnerScreenX/Y + getBoundingClientRect() centre, WITHOUT multiplying by devicePixelRatio — mozInnerScreen* is already in screen pixels, and scaling it again puts the cursor far off target. This exists because some browser features only react to genuine OS-level input — the DevTools eyedropper and HTML5 drag-and-drop both ignore synthesised DOM/WebDriver events, but respond normally to a real SendInput click or drag.

Input Schema

NameRequiredDescriptionDefault
contextNoTab: a browsing context id, or any fragment of the tab URL (default: the active tab)
offsetXNoPixels added to the centre X
offsetYNoPixels added to the centre Y
selectorYesCSS selector of the element

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

readOnlyHint=true is consistent with a pure measurement operation, so the description correctly adds value elsewhere: it discloses the exact measurement method (mozInnerScreenX/Y + getBoundingClientRect centre) and warns against a specific failure mode (double-applying devicePixelRatio). It stops short of describing the return shape, which matters since there is no output schema.

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?

Two sentences, purpose first, rationale second — well front-loaded with no filler. The MEASURED clause is longer than typical but earns its length by preventing a concrete off-target-cursor bug.

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-param read-only geometry helper this covers the why and the how thoroughly. The remaining gap is the return value's shape (coordinate object vs. pair of numbers), which the description gestures at with 'pixel centre' but never specifies, and there is no output schema to fall back on.

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 100%, so the schema already documents selector, context, offsetX and offsetY. The description only reinforces the 'centre' concept and says nothing about how offsets shift the target or how the tab context is resolved, so 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: 'Return the on-screen pixel centre of an element', plus the consumer ('handing to a native input driver'). The clause explaining that this exists for features that ignore synthesised DOM/WebDriver events implicitly separates it from browser_click / browser_mouse_action, which are the obvious siblings an agent might otherwise reach for.

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 concrete trigger condition: use this when a feature reacts only to genuine OS-level input, naming the DevTools eyedropper and HTML5 drag-and-drop as cases where DOM events fail. It never explicitly says 'use browser_click for ordinary clicks', so the exclusion is inferential rather than stated, but the context is clear enough to route correctly.

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

Deploy Server

Other Tools