Skip to main content
Glama

browser_search

Search page elements by text, regex, role, ariaLabel, or CSS selector. Returns confidence-sorted results for precise targeting.

Instructions

Grep-like element search across the current page. by: 'text' (literal substring), 'regex', 'role', 'ariaLabel', 'selector' (CSS). Returns results[] sorted by confidence descending — pass results[0].selector to browser_click. Pagination via offset/maxResults. Caveats: Use browser_overview for broad discovery; use browser_search when you know specific text or role to target. Typed errors: code:'BrowserSearchNoResults' (broaden the by:'text' substring or relax the by:'regex' pattern; switch to browser_overview to enumerate selectors), code:'BrowserSearchTimeout' (reduce maxResults / narrow scope), code:'ScopeNotFound' (the scope CSS selector did not match — verify the selector or omit scope), code:'BrowserNotConnected' (call browser_open first, or browser_open({launch:{}}) to auto-spawn).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
byYesSearch axis: text/regex/role/ariaLabel/selector
patternYesPattern to match against the chosen axis.
scopeNoCSS selector to limit the search scope.
maxResultsNoMax results returned (default 50).
offsetNoOffset into the result set (default 0).
visibleOnlyNoOnly visible elements (default true). Set false to include hidden ones with confidence penalty.
inViewportOnlyNoOnly currently-in-viewport elements (default false).
caseSensitiveNoCase-sensitive matching for text/regex (default false).
tabIdNoTab ID from browser_open. Omit to use the first page tab.
portNoChrome/Edge CDP remote debugging port.
includeNoOptional response-shape opt-in. `['envelope']` returns the self-documenting envelope (`_version` / `data` / `as_of` / `confidence`). `['raw']` forces raw shape (overrides DESKTOP_TOUCH_ENVELOPE=1 server default). Default behaviour is raw shape (compat with existing clients).
Behavior4/5

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

With no annotations, the description carries full burden. It discloses return format (results[] sorted by confidence), pagination behavior, and detailed typed error codes with remedies. While it doesn't explicitly state idempotency or side effects, the search nature implies read-only; the thorough error coverage merits a high score.

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 a single well-organized paragraph that front-loads the core functionality. While it contains multiple sentences, each sentence serves a purpose. Minor improvement could be made by grouping related details, but overall it's efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 11 parameters, no output schema, and high complexity, the description covers purpose, usage, errors, and parameter interplay comprehensively. It lacks explicit return schema details but implies results[] sufficiently. The error codes and alternatives add significant completeness.

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 100%, so baseline is 3. The description adds value by explaining result ordering and pagination, and by providing context for error codes that relate to parameters (e.g., broadening pattern, reducing maxResults). It augments schema descriptions effectively.

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's function as a 'grep-like element search across the current page' and enumerates the search axes (text, regex, role, ariaLabel, selector), making its purpose immediately apparent. It distinguishes itself from sibling tools like browser_overview and browser_click.

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 explicitly tells when to use this tool versus alternatives: 'Use browser_overview for broad discovery; use browser_search when you know specific text or role to target.' It also provides pagination guidance and error suggestions, leaving no ambiguity about appropriate usage.

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