get_user_subscriptions
Retrieve a list of users a specific account is following on X (Twitter) by providing the user ID, count, and cursor for pagination.
Instructions
Retrieves a list of users to which the specified user is subscribed (uses following as proxy)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | ||
| cursor | No | ||
| user_id | Yes |
Implementation Reference
- src/x_twitter_mcp/server.py:174-187 (handler)The main handler function for the 'get_user_subscriptions' tool. It checks rate limits, initializes the Twitter client, fetches the user's following list (used as proxy for subscriptions), and returns the list of user dicts.async def get_user_subscriptions(user_id: str, count: Optional[int] = 100, cursor: Optional[str] = None) -> List[Dict]: """Retrieves a list of subscribed users. (Uses 'following' as a proxy as Twitter API v2 doesn't have a direct 'subscriptions' endpoint). Args: user_id (str): The user ID whose subscriptions (following list) are to be retrieved. count (Optional[int]): The number of users to retrieve per page. Default is 100. cursor (Optional[str]): A pagination token for fetching the next set of results. """ if not check_rate_limit("follow_actions"): raise Exception("Follow action rate limit exceeded") client, _ = initialize_twitter_clients() # Use following as proxy for subscriptions subscriptions = client.get_users_following(id=user_id, max_results=count, pagination_token=cursor, user_fields=["id", "name", "username"]) return [user.data for user in subscriptions.data]
- src/x_twitter_mcp/server.py:173-173 (registration)Registers the 'get_user_subscriptions' tool with FastMCP server using the @server.tool decorator, specifying the name and description.@server.tool(name="get_user_subscriptions", description="Retrieves a list of users to which the specified user is subscribed (uses following as proxy)")
- src/x_twitter_mcp/server.py:174-174 (schema)Input schema defined by function parameters: user_id (str), count (Optional[int]=100), cursor (Optional[str]=None). Output: List[Dict].async def get_user_subscriptions(user_id: str, count: Optional[int] = 100, cursor: Optional[str] = None) -> List[Dict]: