Skip to main content
Glama
qinyuanpei

Weibo MCP Server

get_fans

Retrieve a Weibo user's followers by providing their unique ID, with options to control pagination and limit results for efficient data collection.

Instructions

Get a Weibo user's fans.
    
Returns:
    list[dict]: List of dictionaries containing fan information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uidYesThe unique identifier of the Weibo user
limitNoMaximum number of fans to return, defaults to 15
pageNoPage number for pagination, defaults to 1

Implementation Reference

  • The FastMCP tool handler for 'get_fans', registered via @mcp.tool(). Defines input schema with Annotated Field descriptions for uid, limit, page. Delegates execution to WeiboCrawler.get_fans().
    @mcp.tool()
    async def get_fans(
        ctx: Context, 
        uid: Annotated[int, Field(description="The unique identifier of the Weibo user")], 
        limit: Annotated[int, Field(description="Maximum number of fans to return, defaults to 15", default=15)] = 15,
        page: Annotated[int, Field(description="Page number for pagination, defaults to 1", default=1)] = 1
        ) -> list[dict]:
        """
        Get a Weibo user's fans.
            
        Returns:
            list[dict]: List of dictionaries containing fan information
        """
        return await crawler.get_fans(uid, limit, page)
  • Core helper function in WeiboCrawler that implements the logic for fetching a user's fans via Weibo search API using specific containerid for fans, parsing the response cards, and converting users to UserProfile objects.
    async def get_fans(self, uid: int, limit: int = 15, page: int = 1) -> list[UserProfile]:
        """
        Get fans of a specific Weibo user.
    
        Args:
            uid (int): The unique identifier of the Weibo user
            limit (int): Maximum number of fans to return, defaults to 15
            page (int): The page number for pagination, defaults to 1
    
        Returns:
            list[UserProfile]: List of UserProfile objects containing fan information
        """
        async with httpx.AsyncClient() as client:
            try:
                params = {
                    'containerid': f'231051_-_fans_-_{str(uid)}',
                    'page': page,
                }
                encoded_params = urlencode(params)
    
                response = await client.get(f'{SEARCH_URL}?{encoded_params}', headers=DEFAULT_HEADERS)
                result = response.json()
                cards = result["data"]["cards"]
                if len(cards) < 1:
                    return []
                else:
                    cardGroup = cards[-1]['card_group']
                    return [self._to_user_profile(item['user']) for item in cardGroup][:limit]
            except httpx.HTTPError:
                self.logger.error(f"Unable to get fans for uid '{str(uid)}'", exc_info=True)
                return []
  • Pydantic BaseModel UserProfile defining the output structure for each fan returned by get_fans (list[UserProfile]).
    class UserProfile(BaseModel):
        """
        Data model for a Weibo user's profile information.
        
        Attributes:
            id (int): User's unique identifier
            screen_name (str): User's display name
            profile_image_url (str): URL to user's profile image
            profile_url (str): URL to user's Weibo profile page
            description (str): User's profile description
            follow_count (int): Number of users the user is following
            followers_count (str): Number of followers (as string)
            avatar_hd (str): URL to user's high-resolution avatar image
            verified (bool): Whether the user is verified
            verified_reason (str): Reason for verification
            gender (str): User's gender
        """
        id: int = Field()
        screen_name: str = Field()
        profile_image_url: str = Field()
        profile_url: str = Field()
        description: str = Field()
        follow_count: int = Field()
        followers_count: str = Field()
        avatar_hd: str = Field()
        verified: bool = Field()
        verified_reason: str = Field()
        gender: str = Field()
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 return type ('list[dict]') but doesn't cover critical aspects like whether this is a read-only operation, potential rate limits, authentication requirements, or error handling. For a data retrieval tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 concise and well-structured with two sentences: one stating the purpose and another specifying the return type. There's no unnecessary information, and it's front-loaded with the core functionality. However, the brevity comes at the cost of completeness, as it omits important usage and behavioral details.

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 complexity of a social media data retrieval tool with no annotations and no output schema, the description is incomplete. It doesn't explain what 'fan information' includes, how pagination works beyond the 'page' parameter, or any limitations like maximum 'limit' values. For a tool that likely interacts with an external API and returns structured data, more context is needed to use it effectively.

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 input schema has 100% description coverage, clearly documenting all three parameters (uid, limit, page) with their purposes and defaults. The description adds no additional parameter semantics beyond what the schema provides, such as explaining the structure of fan information or pagination details. Given the high schema coverage, a baseline score of 3 is appropriate as the schema does the heavy lifting.

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 with a specific verb ('Get') and resource ('a Weibo user's fans'), making it immediately understandable. However, it doesn't explicitly differentiate this tool from its sibling 'get_followers', which might retrieve a similar type of social connection data, leaving some ambiguity about when to use one versus the other.

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 like 'get_followers' or 'get_profile'. It lacks context about prerequisites, such as whether the user must be public or authenticated, and doesn't mention any exclusions or specific scenarios where this tool is preferred over others 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/qinyuanpei/mcp-server-weibo'

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