Skip to main content
Glama

get_attribute

Read an HTML attribute value from a selected element to retrieve href, src, value, data, or ARIA properties in the live DOM.

Instructions

Get an HTML attribute value from an element. Returns the attribute value. When to use: to read href, src, value, data attributes, or ARIA properties from an element. Related: get_text (read element text content), get_dom_snapshot (find element selectors). Multi-agent: agent-scoped tabs; cross-agent reject with TAB_NOT_OWNED; cap configurable (default 8, 1-64). Pass tab_id only when this agent owns multiple tabs; auto-resolves otherwise.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tab_idNoOptional. Tab id this read targets. Omit when the calling agent owns exactly one tab; required to disambiguate when the agent owns multiple. Single-tab agents and legacy popup/sidepanel/autopilot do not need to pass this.
selectorYesCSS selector or element ref (e.g., "#link", "a.nav-item", or "e7" from get_dom_snapshot)
attributeYesHTML attribute name (e.g., 'href', 'src', 'value')

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does add real behavior: agent-scoped tabs, cross-agent rejection with the TAB_NOT_OWNED error code, and tab auto-resolution. It omits edge cases such as what is returned when the attribute is absent, and the stray "cap configurable (default 8, 1-64)" reads like it belongs to a tab-listing tool and is confusing here.

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?

Purpose is front-loaded and the description is organized into clear When-to-use, Related, and Multi-agent segments. The multi-agent segment is dense and the tab-cap clause is likely irrelevant noise for a single-attribute read, slightly diluting an otherwise tight definition.

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 tool with no output schema or annotations, the description covers usage, alternatives, and multi-agent ownership adequately. It stops short of describing the return when the attribute is missing, but nothing critical for correct invocation is absent.

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 three parameters are already documented, and the description's attribute examples (href, src, value) largely restate them. It does reinforce the tab_id auto-resolution rule, but adds little beyond the schema, warranting the baseline 3.

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+resource ("Get an HTML attribute value from an element") and the return ("Returns the attribute value"). It explicitly names the sibling reads it is distinct from (get_text, get_dom_snapshot), so an agent can route without opening other 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?

Provides an explicit "When to use" clause enumerating the exact cases (href, src, value, data attributes, ARIA properties) and a "Related" line disambiguating get_text and get_dom_snapshot. Both the when and the alternatives are stated rather than inferred.

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