Skip to main content
Glama

element_tap

Simulate a click on a WeChat Mini Program UI element using CSS selectors. Optionally wait for navigation to stabilize and detect route changes.

Instructions

模拟点击 WXML 元素(element.tap())。selector 用 CSS 选择器定位;要点击自定义组件内部的元素时,用 selector 定位组件(如 #my-comp 或标签名)、innerSelector 定位组件内部元素 —— 这是 page_* 无法穿透自定义组件时的正确做法。selector 支持 [index=N] 取第 N 个(0 基,仅作用于 selector,innerSelector 内不支持下标)。waitMs:点击后额外等待的毫秒数,用于等待导航/重渲染稳定再做下一步。返回 JSON 含 routeBefore,以及【仅当传了 waitMs>0 时】的 routeAfter/routeChanged —— 直接告诉你点击有没有触发跳转,省去再调一次 mp_currentPage。不传 waitMs 时不额外探测路由(routeAfter/routeChanged 为 null,语义=未探测):此时跳转通常尚未完成、读了也不准还白费一次往返,要判断跳转请传 waitMs 等导航稳定。routeAfter 读取失败时同样降级为 null,不影响点击本身已成功。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
waitMsNo
selectorYes
connectionNo可选连接覆盖(不传则用默认会话)。可用字段:mode(launch|connect)、cliPath、projectPath、wsEndpoint、timeout、port(【自动化端口】→ cli auto --auto-port,默认 9420;不是 IDE HTTP 服务端口,别把 IDE 服务端口传进来)、account、ticket、trustProject、args、cwd、autoClose、autoLaunch、launchTimeout、connectTimeout。
innerSelectorNo
Behavior5/5

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

No annotations provided, so description fully covers behavioral traits: selector with index notation, innerSelector for custom components, waitMs behavior, conditional return of routeAfter/routeChanged, and warning about accuracy without waitMs. Thorough and transparent.

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?

Single paragraph with clear, front-loaded action and detailed explanations. Slightly long but every sentence adds value. No 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?

No output schema, but return values are fully explained. All parameters covered. Context of siblings addressed by distinguishing from page_* tools. Complete for complexity level.

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 coverage is only 25% (only connection described), but description adds rich meaning for selector, innerSelector, and waitMs, explaining their usage, syntax, and behavioral impact. Adds significant value beyond 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 clearly states this tool simulates taps on WXML elements, distinguishes it from page_* tools which cannot penetrate custom components, and is named element_tap, making its purpose unambiguous.

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?

Explicitly guides when to use this tool over page_* methods for custom components, and when to use waitMs for navigation detection. Lacks explicit when-not-to-use scenarios but provides sufficient contextual direction.

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/Chaixueyuan/weapp-agent-mcp'

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