Skip to main content
Glama

page_query_xpath

Queries a WeChat mini-program page using an XPath expression to find the first matching element, returning its element_id handle for subsequent automation.

Instructions

在页面中按 XPath 表达式查询首个匹配元素(返回 element_id 句柄)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xpathYesXPath 表达式(选择元素节点),如 //view[contains(@class, "header")]
page_idYes
Behavior3/5

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

No annotations are provided, so the description carries the burden. It discloses that the return is an element_id handle, which is useful, but it doesn't state behavior when no element matches, whether it waits, or if any errors occur. The query nature implies read-only, but this isn't explicit.

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?

One sentence, front-loaded with the core action, no filler. The description efficiently conveys purpose and return value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple 2-parameter query tool without output schema or annotations, the description covers the primary purpose and return type. However, it omits edge-case behavior (e.g., no match, invalid XPath) and assumes the agent knows how the returned handle should be used. Adequate but not comprehensive.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 50% (only xpath is described with an example). The description adds meaning by explaining the XPath query concept, but it doesn't elaborate on page_id beyond the context of '在页面中' (in the page). Page_id remains under-documented, and the description doesn't fully compensate.

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 queries the first matching element by XPath and returns an element_id handle. It distinguishes from siblings like page_query_all and page_query_xpath_all by specifying '首个匹配元素' (first matching element). Verb+resource is specific.

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

Usage Guidelines3/5

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

The description implies usage when you need the first XPath match on a page, but it doesn't explicitly mention alternatives or exclusions. No guidance on when to prefer this over page_query_xpath_all or page_query, leaving the agent to infer the right context.

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/pureia/wechat-devtools-mcp'

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