Skip to main content
Glama
weapp-driver-mcp

weapp-driver-mcp

by Gao12123

Act on a mini program element

mp_element_action

Acts on one selected page element—tap, longpress, input, trigger events, scroll, swipe, slide, or call a component method—re-resolves the selector each call and returns the result plus current page.

Instructions

Act on one element of the current page: tap, longpress, input text, trigger an event, send a raw touch, scroll a scroll-view, swipe a swiper, slide a slider, or call a custom component method. The element is re-resolved from its selector on every call, so actions are replayable; a miss reports the neighbouring elements that did render. Returns the action result and the page you are on afterwards.

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>",
      "action": "<action>"
    },
    "name": "mp_element_action"
  }
}

Input Schema

NameRequiredDescriptionDefault
argsNoArguments for action "call_method".
dataNoData object for action "set_data" on a custom component.
eventNoEvent name for action "trigger", e.g. "confirm" or a custom event.
indexNoZero-based match to act on when the selector hits several elements.
valueNoText to type, for action "input".
xpathNoTreat selector as XPath.
actionYesWhat to do with the element.
detailNoEvent detail object forwarded to the app for action "trigger".
methodNoComponent method name for action "call_method".
touch_xNopageX/clientX for touch actions.
touch_yNopageY/clientY for touch actions.
selectorYesWXML/CSS selector for the element, e.g. ".submit" or "view.title".
x_positionNoHorizontal target for action "scroll_to".
y_positionNoVertical target for action "scroll_to".
target_indexNoSwiper index for "swipe_to", or slider value for "slide_to".
container_selectorNoResolve this selector first, then search inside it.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.8/5.0
Behavior4/5

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

With no annotations supplied, the description carries the full burden and does reasonably well: it discloses that the element is re-resolved from the selector on every call (so actions are replayable), that a miss returns neighbouring rendered elements as diagnostic output, and that the response includes the resulting page. It still omits side-effect timing (whether actions settle/wait) and any permission or session prerequisites for a 12-action mutation tool.

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, front-loaded with the action inventory, then behavior (re-resolution and miss reporting), then the return value. The enumeration is long but functional, and no sentence is redundant.

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?

For a 16-parameter tool with no annotations and no output schema, the description supplies the key behavioral facts an agent needs: selector re-resolution semantics, failure diagnostics, and the shape of the return value. The remaining gap is precondition/state guidance, which matters for a tool that mutates live UI.

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 description coverage is 100%, so every one of the 16 parameters is already documented in the schema, including per-action fields like args, method, event, detail, value, and target_index. The description adds only the selector-resolution behavior, not per-parameter meaning, so the baseline 3 applies.

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?

The opening sentence names the resource (one element of the current page) and enumerates the concrete interaction verbs (tap, longpress, input, trigger, touch, scroll, swipe, slide, custom method), which clearly separates it from the read-only mp_element_read sibling. The verb 'Act' is generic on its own, but the enumeration removes ambiguity about what class of operation this is.

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 through its action list and the replayability note, which tells an agent this is the tool for repeated interactions on a selector. However, it never states when to prefer mp_element_read, mp_expect, or mp_wait instead, and gives no preconditions such as requiring an active mini program page.

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