Skip to main content
Glama
weapp-driver-mcp

weapp-driver-mcp

by Gao12123

Read mini program element fields

mp_element_read

Read multiple fields (text, value, attributes, styles, WXML, custom data) from one Mini Program element in a single call, distinguishing missing attributes from empty values.

Instructions

Read one or more fields from one element of the current page. Every field is read in a single call to avoid a round trip per attribute. Attribute, property and style reads report present separately from the value, so a missing attribute is distinguishable from an empty one. Custom component data (via data_path) and whole-element WXML are available too.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "selector": "<selector>",
      "read": "<read>"
    },
    "name": "mp_element_read"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameNoAttribute, property or style name used by attribute/property/style.
readYesFields to read. text/value/size/offset/wxml work on any element; data needs a custom component; attribute/property/style need `name`.
indexNoZero-based match to use when the selector hits several elements. Defaults to 0.
xpathNoTreat selector as XPath. Not allowed together with container_selector.
selectorYesWXML/CSS selector for the element, e.g. ".submit" or "view.title".
data_pathNoPath inside a custom component data object, e.g. "form.name".
container_selectorNoResolve this selector first, then search inside it. When set, xpath must be false.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.7/5.0
Behavior4/5

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

No annotations are supplied, so the description carries the full burden and does useful work: it discloses batched field reads in a single round trip, and that attribute/property/style reads report `present` separately from the value so missing is distinguishable from empty. It does not say what happens when the selector matches nothing, nor whether a selector matching multiple elements without `index` errors.

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?

Three sentences, purpose front-loaded, and each following sentence adds a distinct capability (batched reads, presence vs value, custom-component data and WXML). No filler wording.

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?

With 7 parameters, no annotations, and no output schema, the description should say more about return shape ('size'/'offset' structure, wxml as a string versus outer_wxml) and about failure behavior. It covers capabilities well but leaves the result contract implicit.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so every parameter already has documentation, making 3 the baseline. The description adds the `present`-flag concept that gives meaning to attribute/property/style reads and mentions data_path and WXML availability, but adds no syntax examples or defaults beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: 'Read one or more fields from one element of the current page.' The scope (single element, current page, field list) is precise. It does not explicitly distinguish itself from siblings like mp_query or mp_element_action, which an agent must infer from the name.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage ('data needs a custom component', 'attribute/property/style need `name`') but those conditions are already in the schema's `read` enum description. There is no explicit when-to-use guidance versus mp_query (searching) or mp_element_action (acting), and no when-not guidance beyond xpath/container_selector exclusion handled in the schema.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.