Skip to main content
Glama

element_getData

Retrieve data from a custom component instance. Use a path to fetch a specific value, or omit it to get the entire component data.

Instructions

读取自定义组件实例的渲染数据(element.data())。仅对自定义组件实例有效;读页面 data 用 page_getData。不传 path 返回整棵组件 data(可能很大、易超 token 上限,建议尽量传 path)。path 取精确子值,如 'list.0.id'(单条路径,不支持 page_getData 的 paths[] 多路径/[*] 通配)。结果超过 maxBytes(默认 50000B,最大 1000000B)会截断。要定位嵌套组件用 selector + innerSelector。selector 支持 [index=N](仅作用于 selector)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNo
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?

With no annotations, the description carries the full burden. It discloses that omitting path returns the entire data (potentially large), truncation behavior based on maxBytes, path format constraints, and selector indexing. It does not explicitly state non-destructive nature but implies it. The description adds valuable behavioral context beyond the tool name.

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 a single dense paragraph that efficiently conveys multiple pieces of information without redundancy. It is front-loaded with the primary purpose. While it could be broken into clearer sentences for readability, it is still concise and to the point.

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 output schema and no annotations, the description covers the main aspects: purpose, key parameters, behavioral details (truncation, path constraints). However, it does not describe the return format or error conditions, which could be useful. It is mostly complete for the tool's complexity.

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 only 20%, so the description compensates by explaining path (exact sub-values, format example), maxBytes (default and max, truncation), and the combined use of selector and innerSelector. The connection parameter is described in the schema but not in the tool description; however, the description covers the core parameters adequately.

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 reads rendering data of custom component instances, using the verb '读取' and specifying the resource. It distinguishes itself from the sibling tool page_getData by noting it only works on custom components.

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 states when to use this tool (for custom components) and when not, directing to page_getData for page data. It also provides usage advice such as preferring path to avoid large data, and explains path format limitations and the use of selector+innerSelector for nested components.

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