Skip to main content
Glama

find_elements

Discover elements matching a CSS selector and receive structured data with count, tag name, text, and optional HTML for each match.

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 to be found. (Defaults to 0.5 seconds.) include_html: If True, include each matching element's outer HTML. If False, return only tag name and text. (Defaults to False.)

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. If there are no matching elements, returns an empty dictionary.

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_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

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed3 schema fields changedv1.2.5
    • removedInput schema / properties / timeout / anyOf
      Removed value: -[
      -  {
      -    "type": "integer"
      -  },
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • changedInput schema / properties / timeout / default
      Previous value: -7New value: +0.5
    • addedInput schema / properties / timeout / type
      Added value: +"number"
  2. Changed1 schema field changedv1.2.1
    • changedInput schema / properties / timeout / anyOf
      Previous value: -[
      -  {
      -    "type": "integer"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "type": "integer"
      +  },
      +  {
      +    "type": "number"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
  3. Addedv1.2.0

TDQS

A5/5.0
Behavior5/5

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

With no annotations provided, the description carries the full behavioral burden, and it delivers. It discloses that element handles resolve immediately into JSON-like dictionaries, that live SeleniumBase objects are not returned, and that element handles cannot be persisted across MCP calls. It also specifies the exact return shape and empty-result behavior, which is valuable beyond the bare schema.

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: summary, args, returns, tool selection, and a note on handle persistence. Every sentence adds useful information, and the most important distinction from sibling tools is front-loaded. The length is justified by the absence of annotations and schema-level parameter descriptions.

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 definition covers the tool's purpose, when to use it versus alternatives, all parameter semantics, the return structure, and the key limitation that element handles cannot persist across MCP calls. This is everything an agent needs to correctly select and invoke the tool, even without annotations.

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?

The input schema provides only names, types, and defaults, with 0% schema description coverage, so the description must compensate. It does so thoroughly by explaining selector syntax with concrete examples, defining timeout as maximum wait seconds with its default, and describing exactly what include_html controls. This adds real meaning beyond the structured schema.

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 precise verb and resource: 'Find matching elements and return structured element information.' It also explicitly distinguishes itself from siblings in the Tool selection section, naming get_content, click, and check_condition as alternatives, so an agent can easily tell what this tool is for.

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 Tool selection section gives concrete when-to-use guidance: use find_elements for structured information about matching elements, get_content for page/single-element text/HTML, click with nth for clicking one match, and check_condition for presence/visibility. This is explicit and actionable, leaving no inference required.

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

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-mcp'

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