Skip to main content
Glama

Get element

browser_get_element
Read-only

Retrieve an element's role, name, state, bounding box, and robust Playwright locator using a snapshot ref, selector, or label to locate and inspect UI elements for browser automation.

Instructions

Role, name, state, bounding box and a robust Playwright locator for an element.

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

Input Schema

NameRequiredDescriptionDefault
nthNo
refNoElement ref from snapshot (preferred)
nameNo
roleNo
textNo
exactNo
labelNo
pageIdNo
testIdNo
withinNoScope to a unique container (ref, role+name, label, testId or CSS selector)
sessionNo
selectorNoCSS (last resort)
placeholderNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

C2.4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false and openWorldHint=true, so the safety profile is covered. The description adds that a robust Playwright locator is returned alongside the element data, which is useful for chaining into other tools, but it says nothing about behavior when no element matches or how multiple matches are resolved.

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

Conciseness3/5

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

It is a single short sentence with no filler, which is good, but the terseness comes at the cost of a missing verb and any usage context. Brevity here reflects under-specification rather than disciplined editing.

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

Completeness2/5

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

For a tool with 13 loosely-constrained locator parameters, a nested within object, and no output schema, this description is far too thin. An agent cannot tell which locator parameter to supply, what happens on ambiguity, or what shape the returned element data takes.

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

Parameters1/5

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

There are 13 parameters at 23% schema description coverage, and 0 required, yet the description says nothing about how an element is identified. The key semantics — that ref is preferred, that role/name/label/testId/selector are fallbacks, and how nth and within disambiguate — exist only partially in the schema and not at all in the description.

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

Purpose3/5

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

The description is a noun fragment listing return fields (role, name, state, bounding box, locator) rather than a verb+resource statement, so it never says 'retrieve element details'. Listing the returned attributes does distinguish it somewhat from browser_get_text and browser_get_attributes, but the agent must infer the actual action.

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

Usage Guidelines2/5

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

No when-to-use, when-not-to-use, or alternative is mentioned. The description gives no hint about when to prefer this over browser_get_attributes, browser_get_text, or browser_snapshot, even though those siblings overlap heavily.

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