Skip to main content
Glama

mp_callWx

Execute WeChat Mini Program API methods to automate development tasks, enabling AI assistants to interact with and control mini program components through the miniprogram-automator interface.

Instructions

调用微信小程序 API 方法。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
connectionNo
methodYes
argsNo

Implementation Reference

  • The execute handler for the 'mp_callWx' tool. It parses input arguments, invokes the miniProgram.callWxMethod with the specified method and args, formats the result, and returns it as text content.
    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: connection (from common), required method string, and optional array of arguments.
    const callWxMethodParameters = connectionContainerSchema.extend({ method: z.string().trim().min(1), args: z.array(z.unknown()).optional(), });
  • The tool object definition and registration within createCallWxMethodTool function, specifying name 'mp_callWx', description, parameters schema, and execute handler.
    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), }) ); } ); }, };
  • Registration of the mp_callWx tool by including it in the array returned by createApplicationTools.
    createCallWxMethodTool(manager),
  • src/tools.ts:9-9 (registration)
    Top-level registration where application tools, including mp_callWx, are composed into the full tools array.
    ...createApplicationTools(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