Skip to main content
Glama

element_getStyles

Retrieve computed CSS style values of elements in WeChat mini programs. Specify selectors and style property names to get targeted styling information.

Instructions

读取元素的计算样式值(element.style(name))。names 为样式名数组,用 camelCase(如 ['color','fontSize','backgroundColor']);单个读不到的名返回 null,全部读取失败则报错。结果超过 maxBytes(默认 50000B)会截断。要读自定义组件内部元素的样式,用 selector 定位组件、innerSelector 定位内部元素。selector 支持 [index=N](仅作用于 selector)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
namesYes
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 fully discloses behaviors: reads computed styles, error handling, truncation, and inner element access via selector/innerSelector. It does not explicitly state read-only nature, but overall transparency is strong.

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?

The description is very concise, front-loading the main purpose in the first sentence, and every subsequent sentence adds specific, non-redundant information about usage and behavior.

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 behavior and edge cases well but lacks description of the return format (e.g., object of style values). Also does not describe the 'connection' parameter. For a tool with 5 parameters and no output schema, slightly more detail would improve completeness.

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?

Description adds significant meaning beyond the schema: explains camelCase format for names, default 50000B for maxBytes, truncation behavior, and selector [index=N] support. Only the 'connection' parameter lacks description, but schema provides its details.

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 it reads computed styles (element.style(name)) using a list of style names. The name 'element_getStyles' and sibling tools like 'element_getAttributes' show it's specifically for styles, distinguishing it from other element access tools.

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?

Provides explicit instructions: use camelCase names array, null for missing individual names, error if all fail, maxBytes truncation, and innerSelector for inner elements. It implies appropriate use cases but does not explicitly exclude alternatives or state when not to use.

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