Skip to main content
Glama

page_expectVisible

Verify that a CSS selector can locate elements in the page, returning pass/fail based on existence or index range, without checking visual visibility.

Instructions

一次性断言选择器能否在页面定位到元素(基于 page.$$ 命中数 > 0,或带 [index=N] 时该索引在范围内)。⚠️ 只判「存在/可定位」,不检查视觉可见性(不看 display/opacity/视口)。不轮询、不抛错——结果在返回的 {pass,expected:true,actual,snapshot:{selector,count,index}} 的 pass 里。⚠️ page.$$ 默认不穿透自定义组件(是否穿透取决于组件 styleIsolation/addGlobalClass,可用 page_getElements 看实际命中数判断),组件内部元素会误判 pass:false,此类用 element_getInnerElements 校验。支持 selector[index=N](0 基)。

Input Schema

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

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

With no annotations, the description fully carries the burden of behavioral disclosure. It states that the tool does not check visual visibility, does not poll, never throws errors, and returns a specific shape ({pass, expected, actual, snapshot}). It also discloses the limitation regarding custom component penetration.

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 relatively long but every sentence adds important information. It is front-loaded with the core purpose. Minor redundancy could be trimmed, but overall it's well-structured and concise for the amount of detail provided.

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 no annotations or output schema, the description is fairly comprehensive. It covers purpose, behavior, return format, and limitations. It could be improved by explicitly listing all return fields, but the snapshot structure is hinted. The connection parameter is not justified in the description.

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?

The description adds meaning to the 'selector' parameter by explaining how it works (based on page.$$ hit counts and optional [index=N] syntax). The 'connection' parameter is already described in the schema, but the description does not add extra semantics for it. Overall, it compensates for missing schema description on the required parameter.

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 purpose: an assertion for whether a selector can locate elements on the page, based on page.$$ hit count or index range. It distinguishes itself from sibling tools like page_expectCount, page_expectElementText, etc., by focusing specifically on existence/locatability.

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 explains when to use this tool (for existence checks only) and when not to use it (e.g., for visual visibility or for elements inside custom components). It provides alternatives: 'element_getInnerElements' for inner component elements, implying other tools for visual checks.

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