Skip to main content
Glama

element_setData

Update custom component rendering data by providing a selector and a data object. Supports nested components via innerSelector and key path notation.

Instructions

写自定义组件实例的渲染数据(element.setData())。仅对自定义组件实例有效;写页面 data 用 page_setData,读用 element_getData。data 为最多 100 个键的 键→值 对象,合并进组件 data(键可用小程序 setData 的路径写法如 'list[0].done')。要定位嵌套组件用 selector + innerSelector。selector 支持 [index=N](仅作用于 selector)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYes
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
Behavior3/5

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

No annotations provided; description covers merging behavior, key limit, path syntax, and innerSelector usage but lacks details on error handling, session requirements, or return values.

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?

Single paragraph efficiently covers key points without fluff. Could be slightly more structured (e.g., bullet points) but not necessary.

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?

Covers core usage constraints and sibling differentiation, but omits return value description and does not explain the connection parameter. Adequate for a well-known operation but could be more complete.

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?

Adds meaning beyond schema: explains data as key-value object with path syntax and 100-key limit, selector supports [index=N], and innerSelector for nesting. Does not detail selector format or connection 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?

Description clearly states it writes rendering data to custom component instances, distinguishes from page_setData and element_getData, and specifies the scope of validity.

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?

Explicitly says when to use (custom components) and when to use alternatives (page_setData for pages, element_getData for reading). Also mentions constraints like max 100 keys and path syntax.

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