Skip to main content
Glama

Robot Actions — Remote Device Control

Webpage get attribute

webpage_get_attribute
Read-onlyIdempotent

Get one attribute (e.g. href, value, aria-label, data-*) of an element in the device browser page, by CSS selector or by a ref from a page-elements listing (iOS Safari or Android Chrome, auto-detected). value is null when the element exists but the attribute is absent. Throws only when the target itself does not resolve.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
refNoElement ref from a page-elements listing, e.g. "e12". Provide this or `selector`. A ref points straight at the element it was issued for, so it survives markup that shifted position, and it can address elements no CSS selector can reach from the top of the page.
nameYesAttribute name to read, e.g. "href", "value", "aria-label"
udidYesDevice UDID / serial (iOS or Android)
pageIdNoTarget page/tab id — auto-picked when omitted
socketNoAndroid only: abstract unix socket name (default: chrome_devtools_remote)
selectorNoCSS selector for the target element. Provide this or `ref`.
platformVersionNoIgnored (kept for compatibility)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • addedInput schema / properties / ref
      Added value: +{
      +  "description": "Element ref from a page-elements listing, e.g. \"e12\". Provide this or `selector`. A ref points straight at the element it was issued for, so it survives markup that shifted position, and it can address elements no CSS selector can reach from the top of the page.",
      +  "type": "string"
      +}
    • changedInput schema / properties / selector / description
      Previous value: -"CSS selector for the element"New value: +"CSS selector for the target element. Provide this or `ref`."
    • changedInput schema / required
      Previous value: -[
      -  "udid",
      -  "selector",
      -  "name"
      -]New value: +[
      +  "udid",
      +  "name"
      +]
  2. First observed

TDQS

A4/5.0
Behavior4/5

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

Annotations already cover the safety profile (readOnly, idempotent, non-destructive, open-world), so the bar is lower, and the description still adds real behavioral context: `value` is null when the element exists but the attribute is absent, and it throws only when the target itself fails to resolve. That error/null semantics is exactly the kind of detail annotations cannot express.

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?

Three tight sentences, front-loaded with what the tool does and how to target the element, followed by the two edge-case behaviors. No filler and nothing redundant.

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?

With no output schema, the description compensates by spelling out the return semantics (null value) and the throw condition, which is what an agent most needs for a single-attribute read. The only minor gap is that it does not explicitly route to sibling tools for related reads.

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%, so all seven parameters (including the ref-vs-selector tradeoff and the ignored platformVersion) are already documented in the schema. The description's attribute examples and selector/ref mention merely echo that, adding no meaning beyond it, 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 (get one attribute of an element in the device browser page) and enumerates concrete attribute examples (href, value, aria-label, data-*), which cleanly separates it from siblings like webpage_get_text or webpage_get_dom. It also discloses the platform scope (iOS Safari / Android Chrome, auto-detected).

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?

It explains how to target the element (CSS selector or a `ref` from a page-elements listing), which is implied usage guidance, but it never names an alternative tool or states when this should be preferred over webpage_get_text, webpage_snapshot, or webpage_evaluate. No when-not conditions are given.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources