Skip to main content
Glama

focus_element

Scroll to, focus, or highlight a page element without clicking or typing. Use it to bring elements into view, set keyboard focus, or highlight for debugging.

Instructions

Scroll to, focus, or highlight an element.

This tool does not click, type, select, hover, or otherwise activate the element. Use click_element, type_text, or hover_action for those operations.

Args: selector: CSS selector or SeleniumBase selector identifying the target.

action:
    - "scroll_to_element": Scroll the element into the viewport.
    - "focus": Move keyboard focus to the element.
    - "highlight": Temporarily highlight the element for debugging or
      demonstration by changing the border color. May affect timing
      and/or reduce stealth.

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

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
actionNoscroll_to_element
timeoutNo
selectorYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.3.3

TDQS

A4.7/5.0
Behavior4/5

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

No annotations are provided, so the description carries the full load and does well: it discloses that 'highlight' mutates the border color, that this may affect timing, and may reduce stealth — a meaningful side-effect warning. It also describes error behavior via @handle_sb_errors on timeout. It stops short of describing permission prerequisites or reversibility, but for a DOM attention operation this is strong disclosure.

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-loaded purpose statement, followed by a tight exclusion sentence and a structured Args block. Slightly verbose with the dedicated non-activation paragraph, but every sentence conveys routing or parameter meaning.

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?

Despite an output schema existing, the description still covers all three parameters, the side effect of highlight, and the timeout failure mode. For a 3-param tool with zero schema coverage, nothing an agent needs to call it correctly is missing.

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 must compensate and it does: it explains each action enum value individually, defines selector as CSS/SeleniumBase, and specifies timeout units and default. This is materially richer than the bare schema titles.

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 specific verbs (scroll to, focus, highlight) on a specific resource (an element), and explicitly distinguishes from siblings by naming click_element, type_text, and hover_action as the tools for activation. An agent can route correctly without opening any schema.

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?

Explicitly states when NOT to use it (does not click, type, select, hover, or activate) and names the alternatives for those operations. The action enum values are also mapped to intent, giving the agent a clear decision path.

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