Skip to main content
Glama
qinyuanpei

Weibo MCP Server

get_profile

Retrieve profile details for a Weibo user by providing their unique identifier, enabling access to user information from the platform.

Instructions

Get a Weibo user's profile information.

Returns:
    dict: Dictionary containing user profile information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uidYesThe unique identifier of the Weibo user

Implementation Reference

  • MCP tool handler for 'get_profile', registers the tool and executes by calling WeiboCrawler.get_profile(uid). Defines input schema via Annotated Field.
    async def get_profile(
        uid: Annotated[int, Field(description="The unique identifier of the Weibo user")],
        ctx: Context
        ) -> dict:
        """
        Get a Weibo user's profile information.
    
        Returns:
            dict: Dictionary containing user profile information
        """
        return await crawler.get_profile(uid)
  • Pydantic BaseModel defining the UserProfile schema, used for output validation and typing in the get_profile implementation.
    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()
  • Core helper function in WeiboCrawler that implements the profile fetching logic from Weibo API using PROFILE_URL and parsing with _to_user_profile.
    async def get_profile(self, uid: int) -> UserProfile:
        """
        Extract user profile information from Weibo.
    
        Args:
            uid (int): The unique identifier of the Weibo user
    
        Returns:
            UserProfile: User profile information or empty dict if extraction fails
        """
        async with httpx.AsyncClient() as client:
            try:
                response = await client.get(PROFILE_URL.format(userId=uid), headers=DEFAULT_HEADERS)
                result = response.json()
                return self._to_user_profile(result["data"]["userInfo"])
            except httpx.HTTPError:
                self.logger.error(
                    f"Unable to eextract profile for uid '{str(uid)}'", exc_info=True)
                return {}
  • Supporting helper that maps raw API user data to the UserProfile Pydantic model.
    def _to_user_profile(self, user: dict) -> UserProfile:
        """
        Convert raw user data to UserProfile object.
    
        Args:
            user (dict): Raw user data from Weibo API
    
        Returns:
            UserProfile: Formatted user profile information
        """
        return UserProfile(
            id = user['id'],
            screen_name = user['screen_name'],
            profile_image_url = user['profile_image_url'],
            profile_url = user['profile_url'], 
            description = user.get('description', ''),
            follow_count = user.get('follow_count', 0),
            followers_count = user.get('followers_count', ''),
            avatar_hd = user.get('avatar_hd', ''),
            verified = user.get('verified', False),
            verified_reason = user.get('verified_reason', ''),
            gender = user.get('gender', '')
        )
  • Constant URL template used in get_profile to fetch user profile data from Weibo API.
    # URL template for fetching user profile information
    # {userId} will be replaced with the actual user ID
    PROFILE_URL = 'https://m.weibo.cn/api/container/getIndex?type=uid&value={userId}'
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 only states what the tool does and the return type, but lacks details on permissions, rate limits, error handling, or whether it's a read-only operation. This is insufficient for a tool that likely involves API calls and user data retrieval.

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 front-loaded, with the core purpose stated in the first sentence and a brief note on the return value. There's no unnecessary information, but it could be slightly more structured (e.g., separating usage notes).

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 lack of annotations and output schema, the description is incomplete. It doesn't cover behavioral aspects like authentication needs or rate limits, and while it mentions the return type, it doesn't detail the structure of the profile information. For a tool with potential complexity in API interactions, this leaves significant gaps.

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%, so the input schema already fully documents the 'uid' parameter. The description adds no additional meaning beyond what the schema provides (e.g., it doesn't explain format constraints or examples). This meets the baseline score when 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 profile information'), making it immediately understandable. However, it doesn't explicitly differentiate this from sibling tools like 'get_followers' or 'search_users', which might also retrieve user-related data, so it doesn't reach the highest 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 scenarios where this is preferred over other sibling tools (e.g., 'get_followers' for follower lists or 'search_users' for finding users by criteria), nor does it specify any prerequisites or exclusions for usage.

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