Skip to main content
Glama

Get Attributes

get_attributes
Read-onlyIdempotent

Retrieve a specific HTML attribute or all attributes from the first element matching a CSS/XPath selector. Returns the attribute value or dictionary, with timeout option.

Instructions

Get a specific HTML attribute (or all attributes) from the first-matching element. Examples of possible attributes include 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: It finds elements to get the requested data, but it does not make any modifications to those elements.

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 observedv0.1.0

TDQS

A4.7/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint, so the safety profile is covered externally. The description adds value beyond that by clarifying the first-matching-element behavior and by describing what happens when no element is found within the timeout via @handle_sb_errors. It also restates the read-only nature in a way consistent with the annotations, though this is somewhat redundant.

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?

The description is well-organized with 'Args' and 'Tool selection' sections and front-loads the main purpose. The read-only sentence is helpful but largely duplicates the annotations, and the prose could be slightly tightened without losing value. Overall it is appropriately sized and scannable.

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?

For a 3-parameter read-only tool with an output schema and safety annotations, the description covers all necessary operational context: parameter semantics, first-match behavior, what happens on timeout, and which sibling tools to use instead. No critical gap remains for an agent to call the tool correctly.

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

Parameters5/5

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

Schema description coverage is 0%, so the description carries full responsibility for parameter meaning. It does so thoroughly: selector includes supported selector syntax, attribute explains the omitted-behavior returning a dictionary, and timeout gives its meaning and default. The examples and default values add meaning the schema does not provide.

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?

The description opens with a precise action: 'Get a specific HTML attribute (or all attributes) from the first-matching element.' This clearly identifies the resource, the verb, and the first-match scoping, and the attribute examples make the domain concrete. It also distinguishes this tool from sibling tools by emphasizing attribute retrieval rather than text, content, or presence checks.

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?

The 'Tool selection' section explicitly states when to use this tool versus find_elements, get_content, and check_if_condition. It gives concrete conditions such as 'Need one or more HTML attribute values' and 'Need to discover multiple matching elements or inspect their text,' so an agent is not left to infer the right choice.

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