Skip to main content
Glama
ascript-cn
by ascript-cn

test_selector

Validate UI selectors on real Android devices by testing filter conditions like text, id, type, desc, or clickable. Returns matched controls and their attributes to ensure correct component targeting before coding.

Instructions

在设备上实时测试 Selector 选择器,验证是否能精准匹配到目标控件。 传入过滤条件(text/id/type/desc/clickable),返回匹配到的控件及其完整属性。 用于编写代码前验证 node.Selector().text('xxx').find() 等语句是否能定位到正确控件。 条件可组合使用,如同时指定 text 和 clickable。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textNo按文本内容匹配
idNo按资源 ID 匹配,如 'com.tencent.mm:id/xxx'
typeNo按控件类型匹配,如 'TextView'、'Button'、'ImageView'
descNo按内容描述匹配
clickableNo是否可点击
modeNo检索模式(Android):0=普通,1=复杂,2=简单过滤系统控件
Behavior3/5

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

No annotations are provided, so the description must disclose behavioral traits. It states the tool tests selectors and returns matching controls, implying a read-only operation. However, it does not explicitly confirm no side effects or destructive actions, which would strengthen transparency.

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?

The description is four concise sentences, each serving a purpose: stating the primary function, listing filters, explaining the use case, and demonstrating combination. No filler or 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?

Given no output schema, the description adequately explains that the tool returns matching controls with complete attributes. It covers the tool's purpose, parameters (via schema), and usage context, making it complete for the AI agent.

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%, providing baseline 3. The description adds value by explaining how parameters can be combined (e.g., text and clickable) and contextualizing their use for selector verification, going beyond schema descriptions.

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 tests a selector on a device to verify it matches the correct control, with specific filter parameters. It distinguishes itself from sibling tools like dump_ui_tree by focusing on live selector testing.

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?

The description explicitly notes this is for verifying selector statements before writing code, providing a clear use case. While it doesn't mention when not to use it or list alternatives, the context is sufficient for an AI agent to understand 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/ascript-cn/ascript-mcp'

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