Skip to main content
Glama

ai_search_wechat_docs

Search WeChat developer documentation for mini-programs, official accounts, and open platforms to find technical resources and API references.

Instructions

📱 微信开发者文档搜索 - 搜索微信小程序、公众号、开放平台文档

【重要】此工具会返回微信文档搜索URL,Claude Code应该使用WebFetch工具访问该URL以获取真实搜索结果。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes搜索关键词
platformNo平台类型all

Implementation Reference

  • Tool registration in AI_TOOLS array, including name, description, and inputSchema definition.
      name: 'ai_search_wechat_docs',
      description: '📱 微信开发者文档搜索 - 搜索微信小程序、公众号、开放平台文档\n\n【重要】此工具会返回微信文档搜索URL,Claude Code应该使用WebFetch工具访问该URL以获取真实搜索结果。',
      inputSchema: {
        type: 'object',
        properties: {
          query: { type: 'string', description: '搜索关键词' },
          platform: { type: 'string', enum: ['miniprogram', 'officialaccount', 'open', 'payment', 'all'], description: '平台类型', default: 'all' }
        },
        required: ['query']
      }
    },
  • Handler function for 'ai_search_wechat_docs' tool. Processes input arguments, constructs search URLs for WeChat developer docs using Baidu site search, generates detailed content with platform-specific info and WebFetch instructions, saves results, and returns a text response.
    case 'ai_search_wechat_docs': {
      const rawQuery = normalizeString(args.query);
      const platformInput = normalizeString(args.platform).toLowerCase();
    
      if (!rawQuery) {
        throw new Error('搜索关键词不能为空');
      }
    
      const platformUrls = {
        miniprogram: `https://developers.weixin.qq.com/miniprogram/dev/framework/`,
        officialaccount: `https://developers.weixin.qq.com/doc/offiaccount/Getting_Started/Overview.html`,
        open: `https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/getting_started/how_to_read.html`,
        payment: `https://pay.weixin.qq.com/wiki/doc/apiv3/index.shtml`,
        all: `https://developers.weixin.qq.com/`
      };
    
      // 构建搜索URL(微信文档使用百度站内搜索)
      const searchUrl = `https://www.baidu.com/s?wd=site:developers.weixin.qq.com ${encodeURIComponent(rawQuery)}`;
    
      const platformNames = {
        miniprogram: '小程序',
        officialaccount: '公众号',
        open: '开放平台',
        payment: '微信支付',
        all: '全平台'
      };
    
      const resolvedPlatform = pickKey(platformNames, platformInput, 'all');
    
      // 常用API分类
      const apiCategories = {
        miniprogram: ['wx.request', 'wx.getUserInfo', 'wx.login', 'wx.showToast', 'wx.navigateTo'],
        officialaccount: ['接收消息', '发送消息', '自定义菜单', '网页授权', '模板消息'],
        payment: ['JSAPI支付', '小程序支付', 'APP支付', '退款', '对账单']
      };
    
      const detailsContent = `📱 微信开发者文档搜索\n\n` +
        `**搜索关键词**: ${rawQuery}\n` +
        `**平台类型**: ${platformNames[resolvedPlatform]}\n\n` +
        `---\n\n` +
        `🔗 **站内搜索**: ${searchUrl}\n` +
        `🔗 **${platformNames[resolvedPlatform]}文档**: ${platformUrls[resolvedPlatform]}\n\n` +
        `⚠️ **请使用 WebFetch 工具获取搜索结果**:\n` +
        `\`\`\`javascript\n` +
        `// 方式1: 百度站内搜索\n` +
        `WebFetch({\n` +
        `  url: "${searchUrl}",\n` +
        `  prompt: "提取微信文档中关于'${rawQuery}'的搜索结果"\n` +
        `})\n\n` +
        `// 方式2: 直接访问文档首页\n` +
        `WebFetch({\n` +
        `  url: "${platformUrls[resolvedPlatform]}",\n` +
        `  prompt: "在文档中查找'${rawQuery}'相关内容"\n` +
        `})\n` +
        `\`\`\`\n\n` +
        `---\n\n` +
        `💡 **常用${platformNames[resolvedPlatform]}API**:\n` +
        (apiCategories[resolvedPlatform] || ['基础组件', 'API接口', '开发工具']).map(api => `• ${api}`).join(' | ') +
        `\n\n📚 **其他微信平台**:\n` +
        Object.keys(platformNames)
          .filter(p => p !== resolvedPlatform)
          .map(p => `• ${platformNames[p]}: ${platformUrls[p]}`)
          .slice(0, 3)
          .join('\n') +
        `\n\n🔗 **开发者社区**: https://developers.weixin.qq.com/community/`;
    
      const filepath = await saveSearchResult('wechat-docs', rawQuery, detailsContent);
    
      return makeTextResponse(
        `📱 **微信开发者文档搜索**\n\n` +
        `**关键词**: ${rawQuery}\n` +
        `**搜索链接**: ${searchUrl}\n\n` +
        `✅ 详细信息已保存至: ${filepath || '保存失败'}\n` +
        `💡 使用 WebFetch 工具访问搜索链接获取结果`
      );
    }

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/adminhuan/smart-search-mcp'

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