Skip to main content
Glama

element_getWxml

Retrieve the WXML structure of a UI element in a WeChat Mini Program. Use selector to target elements, optionally include outer WXML or inner elements of custom components.

Instructions

获取元素 WXML。默认 element.wxml() 返回内部 WXML;outer=true 返回含元素自身的 outerWxml。要读自定义组件内部的 WXML,用 selector 定位组件、innerSelector 定位内部元素。结果超过 maxBytes(默认 50000B)返回 {truncated,bytes,maxBytes,note,data} 包装(WXML 最容易撑爆);截断时改用更具体的 selector 或调大 maxBytes。selector 支持 [index=N](仅作用于 selector)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
outerNo
maxBytesNo
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
Behavior4/5

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

No annotations are provided, so the description carries full burden. It discloses truncation behavior (returns {truncated, bytes, maxBytes, note, data} when exceeding maxBytes), notes that WXML is most likely to exceed, and describes default vs outer behavior. It does not discuss performance or auth, but for a read operation this is sufficient.

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 concise and front-loads the main purpose. It uses a few sentences to cover key details. While it could be more structured (e.g., bullet points), it is efficient and earns its sentences.

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 the parameter complexity (5 params, 1 required, nested object) and no output schema, the description covers the main behavioral aspects: inner vs outer WXML, custom components, and truncation. It does not detail the output format beyond the truncation case, but it provides enough for an agent to select and invoke the tool correctly.

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 20% (only connection object has a description). The description adds significant meaning: explains outer parameter effect, maxBytes default and truncation handling, selector usage with [index=N] syntax, and innerSelector for custom components. This compensates well for the low schema coverage.

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 '获取元素 WXML' (get element WXML), specifying the verb and resource. It distinguishes between internal WXML (default) and outer WXML (with outer=true), and addresses custom component WXML via innerSelector, differentiating it from sibling tools that handle other element properties.

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 provides explicit guidance on when to use outer=true vs default, when to use innerSelector for custom components, and how to handle truncation (use more specific selector or increase maxBytes). It does not explicitly state when not to use this tool, but the scenarios are well-covered.

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