Skip to main content
Glama
rafaljanicki

X (Twitter) MCP server

by rafaljanicki

get_user_following

Retrieve a list of users followed by a specific account on X (Twitter) using the provided user ID, count, and cursor parameters for pagination.

Instructions

Retrieves users the given user is following

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countNo
cursorNo
user_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function that retrieves the list of users a given user is following using the Tweepy Twitter API v2 client.get_users_following method. Includes rate limiting check and pagination support.
    async def get_user_following(user_id: str, count: Optional[int] = 100, cursor: Optional[str] = None) -> List[Dict]:
        """Retrieves a list of users whom the given user is following.
    
        Args:
            user_id (str): The user ID whose following list is to be retrieved.
            count (Optional[int]): The number of users to retrieve per page. Default is 100. Max is 100 for V2 API.
            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()
        following = client.get_users_following(id=user_id, max_results=count, pagination_token=cursor, user_fields=["id", "name", "username"])
        return [user.data for user in following.data]
  • Registers the 'get_user_following' tool with FastMCP server using the @server.tool decorator, specifying the name and description.
    @server.tool(name="get_user_following", description="Retrieves users the given user is following")
  • Type annotations defining the input schema (user_id: str, count: Optional[int], cursor: Optional[str]) and output (List[Dict]) for the tool.
    async def get_user_following(user_id: str, count: Optional[int] = 100, cursor: Optional[str] = None) -> List[Dict]:
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 retrieval but lacks details on permissions needed, rate limits, pagination behavior (implied by cursor/count but not explained), or what the output contains. This is inadequate for a tool with parameters and potential complexity.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words, making it easy to parse and front-loaded with the core purpose. It earns its place by clearly stating the tool's function.

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 has an output schema (which handles return values), no annotations, and low schema coverage, the description is incomplete. It covers the basic purpose but misses usage guidelines, parameter details, and behavioral traits, leaving gaps for an AI agent to operate 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?

Schema description coverage is 0%, so the description must compensate, but it only mentions 'the given user' (hinting at user_id). It doesn't explain count or cursor parameters, leaving them undocumented. The baseline is 3 due to high schema coverage, but here coverage is low, so the description adds minimal value beyond the schema.

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 verb ('retrieves') and resource ('users the given user is following'), making the purpose specific and understandable. It distinguishes from siblings like 'get_user_followers' by focusing on following rather than followers, though it doesn't explicitly name alternatives.

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?

No guidance is provided on when to use this tool versus alternatives like 'get_user_followers' or 'get_user_profile', nor any context about prerequisites or limitations. The description only states what it does, not when it's appropriate.

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

Related 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/rafaljanicki/x-twitter-mcp-server'

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