Skip to main content
Glama
Selenium39

Weibo MCP Server

get_feeds

Retrieve recent posts and updates from a specific Weibo user by providing their unique identifier and desired post limit.

Instructions

获取指定微博用户的最新动态和帖子

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uidYes微博用户的唯一标识符
limitYes返回的最大动态数量

Implementation Reference

  • src/server.ts:51-63 (registration)
    Registers the MCP 'get_feeds' tool with input schema for uid and limit, description, and a handler that calls WeiboCrawler.extractWeiboFeeds and returns JSON stringified feeds.
    server.tool("get_feeds",
      "获取指定微博用户的最新动态和帖子",
      { 
        uid: z.number().describe("微博用户的唯一标识符"),
        limit: z.number().describe("返回的最大动态数量")
      },
      async ({ uid, limit }) => {
        const feeds = await crawler.extractWeiboFeeds(uid, limit);
        return {
          content: [{ type: "text", text: JSON.stringify(feeds) }]
        };
      }
    );
  • Core handler implementing the tool logic: fetches user's Weibo feeds by obtaining containerId from profile, then iteratively fetches pages of feeds until the limit is reached or no more available.
    async extractWeiboFeeds(uid: number, limit: number): Promise<Record<string, any>[]> {
      const feeds: Record<string, any>[] = [];
      let sinceId = '';
      
      try {
        const containerId = await this.getContainerId(uid);
        if (!containerId) return feeds;
    
        while (feeds.length < limit) {
          const pagedFeeds = await this.extractFeeds(uid, containerId, sinceId);
          if (!pagedFeeds.Feeds || pagedFeeds.Feeds.length === 0) {
            break;
          }
    
          feeds.push(...pagedFeeds.Feeds);
          sinceId = pagedFeeds.SinceId as string;
          if (!sinceId) {
            break;
          }
        }
      } catch (error) {
        console.error(`无法获取UID为'${uid}'的动态`, error);
      }
      
      return feeds.slice(0, limit);
    }
  • Helper method to extract the containerId for a user's feeds from their profile API response.
    private async getContainerId(uid: number): Promise<string | null> {
      try {
        const response = await axios.get(PROFILE_URL.replace('{userId}', uid.toString()), {
          headers: DEFAULT_HEADERS
        });
        
        const data = response.data;
        const tabsInfo = data?.data?.tabsInfo?.tabs || [];
        
        for (const tab of tabsInfo) {
          if (tab.tabKey === 'weibo') {
            return tab.containerid;
          }
        }
        return null;
      } catch (error) {
        console.error(`无法获取UID为'${uid}'的containerId`, error);
        return null;
      }
    }
  • Helper method to fetch a single page of user feeds using the feeds API URL constructed with containerId and sinceId, returning PagedFeeds structure.
    private async extractFeeds(uid: number, containerId: string, sinceId: string): Promise<PagedFeeds> {
      try {
        const url = FEEDS_URL
          .replace('{userId}', uid.toString())
          .replace('{containerId}', containerId)
          .replace('{sinceId}', sinceId);
        
        const response = await axios.get(url, { headers: DEFAULT_HEADERS });
        const data = response.data;
        
        const newSinceId = data?.data?.cardlistInfo?.since_id || '';
        const cards = data?.data?.cards || [];
        
        if (cards.length > 0) {
          return { SinceId: newSinceId, Feeds: cards };
        } else {
          return { SinceId: newSinceId, Feeds: [] };
        }
      } catch (error) {
        console.error(`无法获取UID为'${uid}'的动态`, error);
        return { SinceId: null, Feeds: [] };
      }
    }
  • Zod input schema defining parameters for the get_feeds tool: uid (number) and limit (number).
    { 
      uid: z.number().describe("微博用户的唯一标识符"),
      limit: z.number().describe("返回的最大动态数量")
    },
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states what the tool does but doesn't describe behavioral traits like whether it's read-only (implied by '获取' but not explicit), rate limits, authentication needs, error conditions, or what the return format looks like (especially important since there's no output schema). For a tool with no annotations, this is a significant gap.

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 directly states the tool's purpose. It's appropriately sized for a simple tool with two parameters. There's no wasted verbiage, and it's front-loaded with the core functionality.

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

Completeness2/5

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

Given the tool's complexity (simple retrieval), lack of annotations, and absence of an output schema, the description is incomplete. It doesn't explain what the return value contains (e.g., list of posts with fields like text, timestamp, likes), error handling, or behavioral constraints. For a tool with no structured output documentation, the description should provide more context about what to expect.

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 (uid and limit) well-documented in the schema. The description doesn't add any parameter-specific information beyond what's in the schema (e.g., it doesn't explain uid format or limit constraints). With high schema coverage, the baseline is 3, and the description doesn't compensate with extra semantic context.

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 action ('获取' - get/retrieve) and resource ('微博用户的最新动态和帖子' - latest activities and posts of a Weibo user). It specifies the scope ('指定微博用户' - specified Weibo user) and what is retrieved ('最新动态和帖子' - latest activities and posts). However, it doesn't explicitly differentiate from sibling tools like get_profile (which might get user profile info) or search_content (which might search across content).

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 to prefer get_feeds over get_profile (for user info), search_content (for content search), or get_hot_search (for trending topics). 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