Skip to main content
Glama

dom.set_attribute

Set or remove an HTML attribute on a selected page element, using CSS selectors, XPath, snapshot refs, or IDs to target it.

Instructions

Set or remove an attribute on an element.

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": {
      "name": "<name>"
    },
    "name": "dom.set_attribute"
  }
}

Input Schema

NameRequiredDescriptionDefault
nthNoZero-based index when the locator matches several elements.
refNoSnapshot ref (eNN) from page.snapshot.
nameYes
textNoVisible text of the element.
valueNo
xpathNoXPath expression.
removeNo
frame_idNoFrame to search within; see page.list_frames.
selectorNoCSS selector; pierces shadow DOM.
target_idNoTarget handle (tgt_*). Omit for the active page.
browser_idNoBrowser handle (br_*). Omit to use the only running browser, or auto-launch one.
backend_node_idNoCDP backendNodeId, e.g. from inspector.pick.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

C2.6/5.0
Behavior2/5

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

Annotations already declare readOnlyHint=false and openWorldHint=true, so the mutation nature is known. However, the description leaves important behavior unexplained: whether 'remove' deletes the attribute versus blanking it, what happens when 'value' is supplied alongside 'remove', whether changes survive navigation, and whether live page state can break as a result. For a DOM-mutating tool with 12 targeting parameters, this is a real gap beyond what the annotations cover.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The single sentence is front-loaded and free of filler, which is good. But for a 12-parameter mutation tool it is undersized, leaving the definition trading away substance for brevity rather than being appropriately sized.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With 12 parameters, one required field, no output schema, and mutation semantics, the description does far too little. It never explains that the many locator options (ref, selector, xpath, backend_node_id, text, nth, frame_id) are alternatives for identifying the same element.

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 coverage is 75%, and the three undescribed properties are precisely the core ones: 'name' (no schema description at all), 'value', and 'remove'. The description adds no meaning about how value and remove interact or which of the 12 locator parameters takes precedence. It neither compensates for the coverage gap nor exploits the undocumented core parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific verb pair ('Set or remove') and a specific resource ('an attribute on an element'), which is enough to distinguish it from broad siblings like dom.set_html or dom.get_html. It stops short of differentiating itself from the adjacent css.set_style or explaining how the set and remove modes relate.

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

Usage Guidelines2/5

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

There is no guidance on when to use this tool rather than siblings such as dom.set_html, css.set_style, or dom.remove, and no prerequisites or exclusions are given. An agent must infer the intended context entirely from the name.

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

Deploy Server

Other Tools