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 工具访问搜索链接获取结果`
      );
    }
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing key behavioral traits: it returns URLs rather than direct content, and requires a secondary tool (WebFetch) to access actual results. It doesn't mention rate limits, authentication needs, or error handling, but provides crucial workflow information that isn't obvious from the schema alone.

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

Conciseness5/5

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

The description is perfectly front-loaded with the core purpose, followed by critical usage instructions. Every sentence earns its place - the first establishes what it does, the second provides essential workflow guidance. No wasted words or redundant information.

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

Completeness4/5

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

For a search tool with no output schema, the description provides excellent context about what the tool returns (URLs) and how to use those results. It covers the essential workflow despite the lack of structured output documentation. The only minor gap is not explicitly mentioning what happens with empty results or error conditions.

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

Parameters3/5

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

Schema description coverage is 100%, providing good documentation for both parameters. The description doesn't add any parameter-specific information beyond what's in the schema (query for keywords, platform with enum values). This meets the baseline expectation when schema coverage is complete.

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

Purpose5/5

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

The description clearly states the specific verb ('搜索' - search) and resource ('微信开发者文档' - WeChat developer documentation), explicitly distinguishing it from sibling tools like ai_search_aliyun_docs or ai_search_tencent_docs by focusing exclusively on WeChat documentation. The emoji and Chinese title reinforce the specific domain.

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

Usage Guidelines5/5

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

The description provides explicit usage guidance with 【重要】 (Important) notation, specifying that this tool returns URLs and Claude Code should use WebFetch to access real results. This clearly indicates when to use this tool (for WeChat docs search) and what to do with its output, distinguishing it from general search tools in the sibling list.

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

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