Skip to main content
Glama

find_elements

Discover matching elements by selector, returning their count, tag, text, and optional HTML to inspect before taking further action.

Instructions

Find matching elements and return structured element information.

Use this tool when you need to discover how many elements match a selector, inspect their text/tag names, or inspect the HTML of multiple matches.

This tool resolves element handles immediately into ordinary JSON-like dictionaries. It does not return live SeleniumBase element objects.

Args: selector: CSS selector, or a SeleniumBase selector that can match visible text. Examples include "button", ".login-link", or 'a:contains("Sign in")'. timeout: Maximum number of seconds to wait for matching elements. Defaults to 7 seconds. include_html: If True, include each matching element's outer HTML. If False, return only tag name and text.

Returns: A dictionary containing: - count: Number of matching elements found. - matches: A list of element dictionaries containing tag_name and text, plus html when include_html=True.

Tool selection: - Need structured information about matching elements -> use find_elements. - Need the visible text/HTML of a page or a single element -> use get_content. - Need to click one of several matches -> use click with nth. - Need to know whether an element is present/visible -> use check_for_condition.

Note: Element handles cannot be persisted across MCP calls. If you find elements and then need to act on one, resolve it again with the appropriate interaction tool.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timeoutNo
selectorYes
include_htmlNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Install Server

TDQS

A5/5.0
Behavior5/5

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

With no annotations, the description carries the full behavioral burden, and it does so well. It discloses that element handles resolve immediately into JSON-like dictionaries, that live SeleniumBase element objects are not returned, and that handles cannot be persisted across MCP calls. It also explains the include_html behavior and timeout semantics, which are important operational traits not visible elsewhere.

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 organized into clear labeled sections: purpose, args, returns, tool selection, and a persistence note. Each section earns its place, and the most decision-relevant information is front-loaded. Nothing is redundant with the schema.

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?

The description is complete for a read-only query tool with three parameters and no annotations. It covers what the tool returns, how arguments affect behavior, when to choose alternatives, and the critical non-persistence limitation. Even with an output schema present, the narrative return details add needed context.

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 fully compensates. It adds concrete meaning to every parameter: selector gets CSS and SeleniumBase text-matching examples, timeout gets units and default, and include_html gets exact output behavior. This is far beyond what the schema titles alone provide.

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 opens with a specific verb-resource pair ('Find matching elements') and clearly states what kind of result is returned: structured element information with count, tag names, text, and optional HTML. It also differentiates from siblings by framing the tool as the one for structured multi-match inspection, not content extraction or interaction.

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 dedicated 'Tool selection' section explicitly names alternative tools and the conditions that favor each: get_content for page/single-element text, click with nth for clicking a match, and check_for_condition for presence/visibility checks. This gives an agent concrete routing guidance beyond vague 'use when' phrasing.

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

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/seleniumbase/SeleniumBase'

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