Skip to main content
Glama

page_waitElement

Poll until a specified element appears on the page, confirming its existence after async rendering or SSE. Use before reading element content.

Instructions

轮询等待选择器对应的元素出现(最长 timeout 毫秒,每 retryInterval 毫秒重试一次)。何时用:元素来自 setData 后异步渲染 / SSE 流式 / navigateTo 未稳定——先 wait 到再用 page_getElement 取内容(本工具只确认出现,返回 {selector,index?,found:true,waitTime},不返回元素摘要)。元素若必然已存在则直接用 page_getElement(一次性、不存在即抛错)。等任意非元素条件(page.data 字段变化 / SSE done / aiStatus='completed')用 mp_pollUntil(通用 predicate 轮询)。支持 selector[index=N](0 基)。timeout 默认 5000ms,SSE/异步场景建议调大到 10000+;retryInterval 默认 200ms。超时抛错并带具体排查建议(模板插值 class / shadow 不穿透 / 连接级故障 / timeout 太短)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timeoutNo
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。
retryIntervalNo
Behavior5/5

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

Discloses polling behavior (timeout, retryInterval), return format (selector, index?, found:true, waitTime), that it does not return element summary, and timeout error includes troubleshooting suggestions. No annotations, so description carries full burden and does so thoroughly.

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?

Efficiently structured: purpose first, then usage scenarios, comparisons, parameter details, error handling. Every sentence adds useful information without 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?

With 4 parameters, no output schema, and no annotations, the description is self-sufficient. It covers behavior, return value, parameter details, error handling, and use cases. Agent can confidently invoke this tool.

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?

Only connection parameter has schema description (25% coverage). The description compensates by explaining selector's index notation, default timeout and retryInterval, and providing suggestions. 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?

Description clearly states it polls for element appearance, only confirms existence, and distinguishes from page_getElement (content retrieval) and mp_pollUntil (non-element conditions). Verb+resource specific.

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?

Explicitly describes when to use (async rendering, SSE, navigateTo) and when not to (element already exists → use page_getElement; non-element conditions → mp_pollUntil). Provides timeout recommendations (default 5000, suggest 10000+ for async).

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