Skip to main content
Glama

scroll_to_element

Scrolls a specific element into view within web browsers or native applications using selectors or element names, eliminating manual scroll calculations for automation workflows.

Instructions

Purpose: Scroll a named element into the visible viewport without manually computing scroll amounts. Details: Two paths: (1) Chrome/Edge (CDP): provide selector — calls el.scrollIntoView({block, behavior:'instant'}) via CDP. Uses instant (not smooth) scroll so coords stabilize immediately. block controls vertical alignment (start/center/end/nearest, default: center). (2) Native apps (UIA): provide name + windowTitle — calls ScrollItemPattern.ScrollIntoView(). Returns scrolled:true on success, scrolled:false if the element doesn't expose ScrollItemPattern (fall back to scroll + screenshot). Prefer: Use over scroll + screenshot loops when you know the element name or selector. Pairs well with screenshot(detail='text') to confirm the element is now in-view (viewportPosition:'in-view'). For Chrome, browser_get_interactive shows viewportPosition for all elements — use that to decide whether scrolling is needed before calling this tool. Caveats: Chrome path requires browser_connect (CDP active). Native path requires the element to implement UIA ScrollItemPattern — some custom/third-party controls do not; in that case scrolled:false is returned. SPA virtual-scroll lists (React Virtualized, TanStack) may not respond to scrollIntoView. Examples: scroll_to_element({selector: '#create-release-btn'}) — Chrome, scroll to button scroll_to_element({name: 'Create Release', windowTitle: 'Glama'}) — native UIA scroll_to_element({selector: '.submit', block: 'start'}) — align to top of viewport

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNoPartial name/label of the element (UIA name match). Use for native app elements. At least one of name or selector must be provided.
selectorNoCSS selector for the element (Chrome/Edge only). At least one of name or selector must be provided.
windowTitleNoPartial window title (required for native path when name is used)
blockNoVertical alignment after scroll — start/center/end/nearest (Chrome path only, default: center)center
tabIdNoTab ID (Chrome path only). Omit for first page tab.
portNoCDP port for Chrome path (default 9222)
Behavior5/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It thoroughly explains the tool's behavior: two distinct paths (Chrome/Edge CDP and native UIA), return values ('Returns scrolled:true on success, scrolled:false if...'), scroll behavior ('instant (not smooth) scroll so coords stabilize immediately'), prerequisites ('Chrome path requires browser_connect'), and limitations (e.g., SPA virtual-scroll lists may not respond). This covers critical operational details beyond basic functionality.

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-structured with clear sections (Purpose, Details, Prefer, Caveats, Examples) and front-loaded key information. Most sentences earn their place by providing essential context, but some details (like the specific mention of 'React Virtualized, TanStack') could be slightly condensed without losing clarity. Overall, it's appropriately sized for a complex tool.

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?

Given the tool's complexity (6 parameters, dual execution paths, no output schema, no annotations), the description is highly complete. It covers purpose, usage guidelines, behavioral details, parameter context, prerequisites, limitations, and examples. This provides all necessary context for an AI agent to understand when and how to invoke the tool effectively, compensating for the lack of structured annotations and output schema.

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 100%, so the baseline is 3. The description adds significant value by clarifying parameter semantics: it explains the dual-path approach (name/selector for different contexts), provides usage examples that illustrate parameter combinations, and mentions that 'block' controls vertical alignment with default behavior. However, it doesn't fully detail all six parameters (e.g., tabId, port usage nuances), keeping it from a perfect score.

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 explicitly states the purpose as 'Scroll a named element into the visible viewport without manually computing scroll amounts,' which is a specific verb+resource combination. It clearly distinguishes this tool from sibling scrolling tools like 'scroll' (manual scrolling) and 'smart_scroll' (different approach) by emphasizing its element-targeting nature and avoidance of manual computation.

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 description provides explicit guidance on when to use this tool ('Prefer: Use over scroll + screenshot loops when you know the element name or selector') and when not to use it ('Caveats: Chrome path requires browser_connect... Native path requires the element to implement UIA ScrollItemPattern... SPA virtual-scroll lists may not respond'). It also mentions alternatives like 'scroll + screenshot loops' and pairs well with 'screenshot' and 'browser_get_interactive' for verification.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Harusame64/desktop-touch-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server