Skip to main content
Glama
nayakprashant

Selenium MCP Server

get_interactive_elements

Discover visible interactive elements on a web page, returning them with an assigned index for use with click or input tools.

Instructions

Retrieve visible interactive elements from the current web page.

Purpose

This tool scans the page for interactive elements using a performance-optimized selector that works across modern web applications (React, Angular, dynamic UIs).

It identifies elements based on interaction signals such as: - semantic HTML tags (button, input, link) - ARIA roles (button, link, tab, option) - click handlers (onclick) - focusable elements (tabindex)

The discovered elements are returned with an assigned index. This index must be used when interacting with elements using tools such as: - click_element - type_into_element

The function also stores the discovered Selenium elements in an internal session cache so that subsequent tools can safely interact with the exact same elements without re-querying the DOM.

  1. Navigate to a webpage using open_url.

  2. Wait for the page to fully load using wait_for_page.

  3. Call get_interactive_elements to discover UI elements.

  4. Review the returned list of elements and identify the correct element.

  5. Use the provided index with tools like:

    • click_element(index)

    • type_into_element(index, text)

Parameters

session_id : str Active browser session identifier.

Returns

dict { "session_id": str, "count": int, "elements": [ { "index": int, "role": str, "label": str } ], "status": str, "message": str }

Notes

  • The returned index is required for all interaction tools.

  • Only visible and meaningful elements are returned to reduce noise.

  • This tool is optimized for speed and avoids scanning the entire DOM.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idYes
Behavior5/5

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

Despite no annotations, the description details selection signals (semantic tags, ARIA roles, click handlers), caching behavior, and performance optimization. It discloses that only visible meaningful elements are returned and that the tool avoids full DOM scanning.

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?

The description is well-structured with clear sections (Purpose, Workflow, Parameters, Returns, Notes). It is front-loaded with the main purpose, and every sentence contributes value without redundancy.

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 low complexity (1 param, no output schema) and many siblings, the description fully covers purpose, usage, parameter, return structure, and behavioral notes. It provides sufficient context for correct tool selection and invocation.

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 coverage is 0%, but the description defines session_id as 'Active browser session identifier', adding meaning beyond the schema's title. While not exhaustive, it adequately explains the parameter's purpose.

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 clearly states the tool retrieves visible interactive elements from a web page, using specific verb and resource. It distinguishes from siblings by explaining the index is used by interaction tools like click_element and type_into_element.

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?

A 'Recommended Agent Workflow' explicitly outlines when to use the tool: after open_url and wait_for_page, and before click_element/type_into_element. It also emphasizes that the returned index is required for interaction.

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/nayakprashant/selenium-mcp-server'

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