Skip to main content
Glama

mp_callWx

Execute WeChat Mini Program API methods to automate development tasks, enabling navigation, inspection, and manipulation of pages and components through the miniprogram-automator API.

Instructions

调用微信小程序 API 方法。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
connectionNo
methodYes
argsNo

Implementation Reference

  • The createCallWxMethodTool function defines and returns the tool object for 'mp_callWx', including the execute handler that parses parameters, uses the manager to call the miniProgram's callWxMethod, and returns formatted result.
    function createCallWxMethodTool(manager: WeappAutomatorManager): AnyTool { return { name: "mp_callWx", description: "调用微信小程序 API 方法。", parameters: callWxMethodParameters, execute: async (rawArgs, context: ToolContext) => { const args = callWxMethodParameters.parse(rawArgs ?? {}); return manager.withMiniProgram<ContentResult>( context.log, { overrides: args.connection }, async (miniProgram) => { const callArgs = args.args ?? []; const result = await miniProgram.callWxMethod( args.method, ...callArgs ); return toTextResult( formatJson({ method: args.method, arguments: callArgs, result: toSerializableValue(result), }) ); } ); }, }; }
  • Zod schema defining the input parameters for the mp_callWx tool: extends connectionContainerSchema with required 'method' string and optional 'args' array.
    const callWxMethodParameters = connectionContainerSchema.extend({ method: z.string().trim().min(1), args: z.array(z.unknown()).optional(), });
  • The createApplicationTools function registers createCallWxMethodTool (mp_callWx) into the array of application tools.
    export function createApplicationTools( manager: WeappAutomatorManager ): AnyTool[] { return [ createEnsureConnectionTool(manager), createNavigateTool(manager), createScreenshotTool(manager), createCallWxMethodTool(manager), createGetConsoleLogsTool(manager), ]; }
  • src/tools.ts:7-13 (registration)
    The createTools function includes application tools (containing mp_callWx) by spreading createApplicationTools.
    export function createTools(manager: WeappAutomatorManager): AnyTool[] { return [ ...createApplicationTools(manager), ...createPageTools(manager), ...createElementTools(manager), ]; }
  • src/index.ts:17-17 (registration)
    Top-level registration of all tools, including mp_callWx, to the FastMCP server via createTools.
    server.addTools(createTools(manager));

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