Skip to main content
Glama

get_attributes

Retrieve HTML attribute values from the first element matching a CSS or XPath selector. Specify an attribute for its value, or omit it to get all attributes as a dictionary.

Instructions

Read HTML attributes from the first matching element.

Use this tool when you need the value of a specific HTML attribute, or all HTML attributes of an element. Attributes could be something such as href, src, value, class, id, name, type, aria-label, etc.

Args: selector: CSS selector or SeleniumBase-supported XPath selector.

attribute: Specific HTML attribute to retrieve. When omitted, return
    all HTML attributes of the first matching element as a dictionary.

timeout: Maximum seconds to wait for the target element. Default: 5.

Tool selection: - Need one or more HTML attribute values from a specific element -> use this tool. - Need to discover multiple matching elements or inspect their text -> use 'find_elements'. - Need visible text or HTML content -> use 'get_content'. - Need to check element presence/visibility -> use 'check_if_condition'.

This is a read-only operation.

If there's no matching element found within the timeout, then @handle_sb_errors returns details from the exception raised.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timeoutNo
selectorYes
attributeNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.15.0

TDQS

A4.6/5.0
Behavior4/5

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

With no annotations, the description carries the burden and does most of it: it declares the operation read-only, documents the default 5s timeout wait, and explains the no-match path (exception surfaced via @handle_sb_errors). It does not say whether the element is scrolled into view or how attribute-name casing/normalization is handled, so it is strong but not exhaustive.

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?

Front-loads the core behavior in the first sentence, then organizes parameters and tool-selection routing into clearly labeled blocks. Slight redundancy between the opening line and the Args section, but every block carries usable information rather than padding.

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?

An output schema exists, so return values need not be enumerated, and the description still notes the dictionary shape when attribute is omitted. Combined with the timeout semantics and the documented error path, an agent has everything needed to call this correctly for a simple 3-parameter read tool.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must compensate and largely does: selector is defined as a CSS selector or SeleniumBase-supported XPath, attribute is explained with its omitted-behavior (return all attributes as a dictionary), and timeout is given a meaning plus its default. It stops short of edge cases like invalid selectors or case sensitivity.

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 precise verb and resource ('Read HTML attributes from the first matching element'), including the scoping detail that only the first match is used. That scoping is exactly what separates it from find_elements, so an agent can distinguish it 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?

Contains an explicit 'Tool selection' block that names the alternative tools (find_elements, get_content, check_if_condition) and the condition that routes to each. It also states the positive trigger ('need the value of a specific HTML attribute'). Both when-to-use and when-not are covered.

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