Skip to main content
Glama
yfmeii

WeChat Mini Program Dev MCP

by yfmeii

page_getData

Retrieve data objects from the current page in WeChat Mini Programs, with optional path specification for targeted extraction.

Instructions

获取当前页面的数据对象,可选择指定路径。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
connectionNo
pathNo

Implementation Reference

  • The execute handler function for the page_getData tool. It parses input parameters, uses the manager to execute on the page, calls page.data(path) to get data, serializes it, and returns formatted JSON.
    execute: async (rawArgs, context: ToolContext) => {
      const args = getPageDataParameters.parse(rawArgs ?? {});
      return manager.withPage<ContentResult>(
        context.log,
        { overrides: args.connection },
        async (page) => {
          const data = await page.data(args.path);
          return toTextResult(
            formatJson({
              path: args.path ?? null,
              data: toSerializableValue(data),
            })
          );
        }
      );
    },
  • Zod schema defining the input parameters for the page_getData tool: optional path string, extending connectionContainerSchema.
    const getPageDataParameters = connectionContainerSchema.extend({
      path: z.string().trim().min(1).optional(),
    });
  • Local registration of page_getData tool within the createPageTools factory function, which returns an array of page-related tools including page_getData.
    export function createPageTools(manager: WeappAutomatorManager): AnyTool[] {
      return [
        createGetElementTool(manager),
        createWaitForElementTool(manager),
        createWaitForTimeoutTool(manager),
        createGetPageDataTool(manager),
        createSetPageDataTool(manager),
        createCallPageMethodTool(manager),
      ];
    }
  • src/tools.ts:7-13 (registration)
    Intermediate registration aggregating page tools (including page_getData) via spread of createPageTools(manager).
    export function createTools(manager: WeappAutomatorManager): AnyTool[] {
      return [
        ...createApplicationTools(manager),
        ...createPageTools(manager),
        ...createElementTools(manager),
      ];
    }
  • src/index.ts:17-17 (registration)
    Final server-level registration of all tools, including page_getData, by adding the output of createTools to the FastMCP server.
    server.addTools(createTools(manager));
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure but offers minimal information. It doesn't describe what happens when no path is specified (default behavior), whether this is a read-only operation, what permissions might be required, or what format the data object returns. The description is insufficient for a tool with complex connection parameters.

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 appropriately concise with a single sentence that states the core purpose and mentions the optional path parameter. It's front-loaded with the main functionality, though it could be more structured given the tool's complexity.

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

Completeness2/5

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

Given the tool's complexity (2 parameters with one being a highly nested connection object), lack of annotations, 0% schema description coverage, and no output schema, the description is severely incomplete. It doesn't address what the connection object does, how to establish page context, or what the returned data object contains.

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

Parameters2/5

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

With 0% schema description coverage and 2 parameters (one being a complex nested object with 13 properties), the description only mentions the optional 'path' parameter and completely ignores the critical 'connection' object. The description fails to compensate for the schema's lack of documentation, leaving most parameters unexplained.

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

Purpose3/5

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

The description states the tool '获取当前页面的数据对象' (gets the current page's data object) which provides a basic verb+resource, but it's vague about what '数据对象' (data object) specifically means. It doesn't distinguish this from sibling tools like page_getElement or page_setData, leaving ambiguity about what type of data is retrieved.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like page_getElement or page_setData. It mentions an optional path parameter but gives no context about when path specification is appropriate or what scenarios this tool is designed for.

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