Skip to main content
Glama
Selenium39

Weibo MCP Server

search_users

Find Weibo users by entering keywords to discover relevant profiles and accounts matching your search criteria.

Instructions

根据关键词搜索微博用户并返回匹配的用户列表

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keywordYes查找用户的搜索词
limitYes返回的最大用户数量

Implementation Reference

  • src/server.ts:18-30 (registration)
    Registers the 'search_users' MCP tool, defining its description, input schema with Zod, and inline handler that delegates to WeiboCrawler.searchWeiboUsers
    server.tool("search_users",
      "根据关键词搜索微博用户并返回匹配的用户列表",
      { 
        keyword: z.string().describe("查找用户的搜索词"),
        limit: z.number().describe("返回的最大用户数量")
      },
      async ({ keyword, limit }) => {
        const users = await crawler.searchWeiboUsers(keyword, limit);
        return {
          content: [{ type: "text", text: JSON.stringify(users) }]
        };
      }
    );
  • Implements the core logic for searching Weibo users by keyword: constructs API URL for mobile Weibo search, fetches data with axios, parses cards to extract user list, maps to SearchResult using toSearchResult helper, limits results.
    async searchWeiboUsers(keyword: string, limit: number): Promise<SearchResult[]> {
      try {
        const params = { 'containerid': `100103type=3&q=${keyword}&t=`, 'page_type': 'searchall' };
        const searchParams = new URLSearchParams();
        for (const [key, value] of Object.entries(params)) {
          searchParams.append(key, value);
        }
        const queryString = searchParams.toString();
        
        const response = await axios.get(`https://m.weibo.cn/api/container/getIndex?${queryString}`, {
          headers: DEFAULT_HEADERS
        });
        
        const result = response.data;
        const cards = result.data.cards;
        
        if (cards.length < 2) {
          return [];
        } else {
          const cardGroup = cards[1]['card_group'];
          return cardGroup.map((item: any) => this.toSearchResult(item.user)).slice(0, limit);
        }
      } catch (error) {
        console.error(`无法搜索关键词为'${keyword}'的用户`, error);
        return [];
      }
    }
  • Zod input schema for 'search_users' tool defining keyword (string) and limit (number) parameters.
    { 
      keyword: z.string().describe("查找用户的搜索词"),
      limit: z.number().describe("返回的最大用户数量")
    },
  • Helper method to transform raw Weibo user data into standardized SearchResult interface.
    private toSearchResult(user: any): SearchResult {
      return {
        id: user.id,
        nickName: user.screen_name,
        avatarHD: user.avatar_hd,
        description: user.description
      };
    }
  • TypeScript interface defining the output structure for search results (SearchResult[]).
    export interface SearchResult {
      /**
       * 用户的唯一标识符
       */
      id: number;
      
      /**
       * 用户的显示名称
       */
      nickName: string;
      
      /**
       * 用户高分辨率头像图片的URL
       */
      avatarHD: string;
      
      /**
       * 用户的个人简介
       */
      description: string;
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the action ('搜索' - search) and outcome ('返回匹配的用户列表' - return matching user list), but doesn't describe important behavioral traits like whether this is a read-only operation, potential rate limits, authentication requirements, pagination behavior, or what fields are included in the returned user list. For a search tool with zero annotation coverage, this is insufficient.

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 a single, efficient sentence that states the core functionality without unnecessary words. It's appropriately sized for a simple search tool. However, it could be slightly more front-loaded by explicitly mentioning it's for Weibo users earlier in the sentence, but this is a minor issue.

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

Completeness3/5

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

Given the tool's moderate complexity (search operation with 2 parameters), no annotations, and no output schema, the description is minimally adequate. It explains what the tool does but lacks important context about behavioral characteristics, usage guidelines, and output format. The description doesn't compensate for the absence of annotations and output schema, making it incomplete for optimal agent understanding.

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?

The schema description coverage is 100%, with both parameters ('keyword' and 'limit') having clear descriptions in the schema. The description adds no additional parameter semantics beyond what's already documented in the schema. According to the scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no parameter information in the description.

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

Purpose4/5

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

The description clearly states the tool's purpose: '根据关键词搜索微博用户并返回匹配的用户列表' (Search Weibo users by keyword and return matching user list). It specifies the verb ('搜索' - search), resource ('微博用户' - Weibo users), and outcome ('返回匹配的用户列表' - return matching user list). However, it doesn't explicitly differentiate from sibling tools like 'search_content' or 'get_profile', which prevents a perfect score.

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. It doesn't mention when this tool is appropriate compared to sibling tools like 'search_content' (which might search posts instead of users) or 'get_profile' (which might retrieve specific user details). There's no context about use cases, prerequisites, or exclusions.

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/Selenium39/mcp-server-weibo'

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