Skip to main content
Glama

browser_click

Click a DOM element by CSS selector in a real browser. When multiple matches occur, specify an index to choose which element to click.

Instructions

Click a DOM element matched by CSS selector in a real browser. Returns multi-element hint (not timeout) when selector matches multiple elements; use index to pick which one.

中文详情:

  • 用途:在真实浏览器中模拟鼠标点击指定 CSS 选择器元素(按钮、链接、tab、复选框等)

  • 何时使用:触发导航或表单提交时;激活 UI 控件(展开菜单、切换 tab)时;验证按钮可点击性时;在 browser_snapshot 获取元素 ref 后进行交互时

  • 输出:{ ok: boolean, clickedSelector: string, beforeHash: string, afterHash: string, index: number } — afterHash 与 beforeHash 不同表示触发了页面变更

  • 参数:

    • selector (string, 必填):CSS 选择器,支持 Playwright 语法如 'button:has-text("Log In")' 或 '#submit-btn'

    • index (number, 可选):当选择器匹配多个元素时,指定点击第几个(从 0 开始),默认点击第一个

  • 错误:选择器无匹配抛出 'element not found';元素被遮挡抛出 'element not clickable'

  • 示例:{"selector":"#submit-btn","index":0}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexNo当选择器匹配多个元素时,指定点击第几个元素(从 0 开始)。不提供时默认点击第一个元素。
selectorYesCSS 选择器(支持 Playwright 语法,如 'button:has-text("Log In")' 或 '#submit-btn')
Behavior4/5

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

Discloses key behaviors: returns multi-element hint instead of timeout when multiple matches, uses index to disambiguate. Describes output fields and error conditions. No annotations provided, so description carries full burden. Minor omission: doesn't mention waiting behavior or scrolling.

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?

Well-structured with English summary followed by Chinese details in bullet points. Some redundancy between English and Chinese, but clear and front-loaded with key behavior. Could be slightly more concise.

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 no output schema, description covers output fields, error conditions, multi-element behavior, and use cases. Completely adequate for a click tool with good contextual detail.

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 covers both parameters with descriptions (100% coverage). Description adds value by providing example usage and clarifying supported syntax (Playwright) and index selection behavior, which goes beyond bare 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?

Clearly states the tool clicks a DOM element matched by CSS selector in a real browser. Specific verb (click) and resource (DOM element). Distinguishes from siblings like browser_hover and browser_type by focusing on clicking. Also mentions multi-element handling.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit when-to-use scenarios in the Chinese section (e.g., triggering navigation, activating UI controls, verifying clickability, after snapshot). Does not explicitly name alternatives or state when not to use, but context is clear.

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/validpilot/ai-verify-mcp'

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