Skip to main content
Glama
rafaljanicki

X (Twitter) MCP server

by rafaljanicki

get_user_mentions

Retrieve tweets mentioning a specific user by providing their user ID, enabling targeted social media analysis and engagement tracking on the X (Twitter) platform.

Instructions

Get tweets mentioning a specific user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countNo
cursorNo
user_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function that implements the get_user_mentions tool. It initializes the Twitter client and calls get_users_mentions to fetch tweets mentioning the specified user ID, with pagination support.
    async def get_user_mentions(user_id: str, count: Optional[int] = 100, cursor: Optional[str] = None) -> List[Dict]:
        """Fetches tweets mentioning a specific user.
    
        Args:
            user_id (str): The ID of the user whose mentions are to be retrieved.
            count (Optional[int]): Number of mentions to retrieve. Default 100. Min 5, Max 100 for get_users_mentions.
            cursor (Optional[str]): Pagination token for fetching the next set of results.
        """
        client, _ = initialize_twitter_clients()
        mentions = client.get_users_mentions(id=user_id, max_results=count, pagination_token=cursor, tweet_fields=["id", "text", "created_at"])
        return [tweet.data for tweet in mentions.data]
  • Registers the get_user_mentions tool with the FastMCP server using the @server.tool decorator, specifying the name and description.
    @server.tool(name="get_user_mentions", description="Get tweets mentioning a specific user")
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 but only states the basic function. It doesn't mention whether this is a read-only operation, if it requires authentication, rate limits, pagination behavior (implied by 'cursor' param but not explained), or what the output contains. This leaves significant gaps for a tool with 3 parameters.

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, front-loaded sentence with zero wasted words. It efficiently conveys the core purpose without unnecessary elaboration, making it easy to parse quickly.

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's moderate complexity (3 params, no annotations) but with an output schema (which handles return values), the description is minimally adequate. It covers the 'what' but lacks behavioral context, parameter details, and usage guidance, leaving the agent to infer from schema alone.

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 description adds no parameter-specific information beyond implying 'user_id' is required for targeting. With 0% schema description coverage, it doesn't compensate by explaining 'count' (default, range), 'cursor' (pagination), or 'user_id' format. However, the baseline is 3 since the description at least hints at the core parameter purpose.

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') and resource ('tweets mentioning a specific user'), making the purpose immediately understandable. It doesn't explicitly differentiate from siblings like 'search_twitter' or 'get_user_profile', but the focus on user mentions is specific enough for basic clarity.

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 'search_twitter' (which might also find mentions) or 'get_user_profile' (for user info). The description lacks context about prerequisites, timing, or exclusions, leaving usage decisions ambiguous.

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