Skip to main content
Glama
yfmeii

WeChat Mini Program Dev MCP

by yfmeii

element_input

Type text into a specified element in a WeChat Mini Program. Provide a CSS selector and the text value.

Instructions

向指定元素输入文本。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
connectionNo
selectorYes
innerSelectorNo
valueYes

Implementation Reference

  • Handler function for the element_input tool. Resolves the element by selector (and optional innerSelector), then calls element.input(args.value) to input text. The result is returned as a text message confirming the input.
    function createInputTextTool(manager: WeappAutomatorManager): AnyTool {
      return {
        name: "element_input",
        description: "向指定元素输入文本。",
        parameters: inputTextParameters,
        execute: async (rawArgs, context: ToolContext) =>
          withUserErrorResult(async () => {
          const args = inputTextParameters.parse(rawArgs ?? {});
          return manager.withPage(
            context.log,
            { overrides: args.connection },
            async (page) => {
              const element = await resolveElement(
                page,
                args.selector,
                args.innerSelector
              );
    
              await element.input(args.value);
              return toTextResult(
                `已向元素 "${args.selector}"${args.innerSelector ? ` -> "${args.innerSelector}"` : ""} 输入值 "${args.value}"。`
              );
            }
          );
          }),
      };
  • Input schema for element_input tool: selector (required), innerSelector (optional), value (string or number, coerced).
    const inputTextParameters = connectionContainerSchema.extend({
      selector: z.string().trim().min(1),
      innerSelector: z.string().trim().min(1).optional(),
      value: z.union([z.string(), z.coerce.number()]),
    });
  • Registration of element_input tool within createElementTools(), which is called from src/tools.ts createTools().
    export function createElementTools(
      manager: WeappAutomatorManager
    ): AnyTool[] {
      return [
        createTapElementTool(manager),
        createInputTextTool(manager),
        createCallElementMethodTool(manager),
Behavior2/5

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

With no annotations provided, the description carries the full burden of disclosure. It only says 'input text' without indicating whether the tool replaces existing content, appends, or triggers events. There is no mention of side effects, permissions, or response behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise (one short sentence), but it is under-specified for a tool with 4 parameters, nested objects, and no annotations. Conciseness should not come at the cost of essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (multiple parameters, no output schema, no annotations), the description is severely incomplete. It fails to address parameter roles, behavioral nuances, or usage context, leaving a significant knowledge gap for the agent.

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

Parameters1/5

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

Schema description coverage is 0%, so the description must compensate by explaining parameter meanings. It does not describe any parameter, including key ones like 'selector', 'value', or the complex 'connection' object. The agent is left to infer from names alone.

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 description clearly states the action (input text) and target (specified element), making the tool's primary purpose understandable. However, it does not differentiate from sibling tools like element_setData or element_tap, which could also involve modifying element state.

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

Usage Guidelines1/5

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

No guidance is provided on when to use this tool versus alternatives such as element_setData or page_callMethod. The description lacks any context about prerequisites, when input is appropriate, or when other tools should be preferred.

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/yfmeii/weapp-dev-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server