Skip to main content
Glama

attr

Read-onlyIdempotent

Fetch an HTML element's named property value, such as href, src, class, data-* or aria-*, and return null when it is absent.

Instructions

[Agent Browser] Get an HTML attribute value from an element. Common attributes: href, src, class, data-, aria-, disabled. Returns null if attribute doesn't exist. Use value() for input values.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "selector": "<selector>",
      "attribute": "<attribute>"
    },
    "name": "attr"
  }
}

Input Schema

NameRequiredDescriptionDefault
selectorYes
attributeYes

Output Schema

NameRequiredDescriptionDefault
dataNo
hintsNo
messageNo
successNo
suggestionsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

A3.9/5.0
Behavior3/5

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

Annotations already declare readOnly, idempotent, non-destructive, and closed-world, so the safety profile is fully covered. The description adds the useful missing-value behavior ('Returns null if attribute doesn't exist'), but says nothing about element-not-found behavior or whether the lookup waits/retries.

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?

Four short sentences, purpose front-loaded, then examples, then return behavior, then the sibling distinction. Nothing is redundant or padded.

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?

An output schema exists, so return shape need not be documented, and the null case is nonetheless mentioned. The one material gap is selector syntax, which an agent must guess for a two-required-parameter tool with zero schema descriptions.

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

Parameters2/5

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

Schema description coverage is 0% for both required parameters, so the description carries the burden. It clarifies the 'attribute' parameter with a list of common attribute names, but never explains what form 'selector' takes (CSS vs. XPath) or how a bare attribute name resolves to an element.

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 an HTML attribute value from an element') and explicitly names the sibling it is not ('Use value() for input values'). An agent can distinguish it from value() without opening either schema.

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

Usage Guidelines4/5

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

Provides one explicit routing rule to the sibling value() for the input-value case, which is the main ambiguity an agent would face. It stops short of stating when-not to use attr at all (e.g., vs. evaluate or find_elements), but the primary alternative is covered.

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