Skip to main content
Glama

element_getInnerElement

Query a single child element within a scoped container using selector and targetSelector. Returns element summary; use to narrow search inside custom components.

Instructions

在一个已定位元素的范围内查询单个子元素(element.$(targetSelector)),返回该子元素摘要(tagName/text/value/size/offset)。用法:selector(+可选 innerSelector)先定位作用域元素,targetSelector 是在该作用域内执行的查询 —— 适合在某容器/自定义组件内部缩小查询范围;若从页面根查询请用 page_getElement。withWxml=true 时额外返回该子元素的完整 outerWxml(可能很大)。结果超过 maxBytes(默认 50000B)返回 {truncated,bytes,maxBytes,note,data} 包装,关掉 withWxml 或调大 maxBytes。selector 支持 [index=N](仅作用于 selector,innerSelector/targetSelector 内不支持下标)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
maxBytesNo
selectorYes
withWxmlNo
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
targetSelectorYes
Behavior4/5

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

Since no annotations are provided, the description carries the full burden. It discloses that withWxml can return large data, results can be truncated with a wrapper object, and maxBytes can be adjusted. It also mentions selector index support limitations. It does not explicitly state read-only behavior but it is implied.

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 reasonably concise but dense with information. It is well-structured: first states purpose, then usage, then details about withWxml and truncation, then selector limitations. Each sentence adds value, though some redundant phrasing exists.

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 complexity (6 parameters, nested connection object, no output schema), the description explains inputs, behavior, and edge cases (truncation, Wxml size). It mentions return fields (tagName, text, value, size, offset) but does not detail the truncation wrapper structure. It is missing some error handling details but overall 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?

Schema description coverage is only 17% (connection only). The description adds meaning to most parameters: selector (scope element), targetSelector (query within scope), innerSelector (optional scope refinement), withWxml (return full Wxml), maxBytes (truncation threshold). It does not fully describe selector format (e.g., CSS selector), but provides sufficient context.

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's purpose: query a single child element within a scoped element and return a summary (tagName, text, value, size, offset). It distinguishes from page_getElement for root queries and implicitly from element_getInnerElements (plural).

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 says when to use (inside a container/custom component) and when not (use page_getElement for page root). It mentions alternatives for root queries. However, it does not explicitly contrast with the sibling tool element_getInnerElements.

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