Skip to main content
Glama
rafaljanicki

X (Twitter) MCP server

by rafaljanicki

get_highlights_tweets

Retrieve highlighted tweets from a specific user's timeline using their user ID. Customize results by setting the count and cursor for targeted data extraction.

Instructions

Retrieves highlighted tweets from a user's timeline (simulated)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countNo
cursorNo
user_idYes

Implementation Reference

  • Registers the 'get_highlights_tweets' tool with FastMCP server using the @server.tool decorator.
    @server.tool(name="get_highlights_tweets", description="Retrieves highlighted tweets from a user's timeline (simulated)")
  • The handler function that implements the tool logic by initializing the Twitter client and fetching the user's recent tweets using `get_users_tweets` as a proxy for 'highlights', since no direct endpoint exists.
    async def get_highlights_tweets(user_id: str, count: Optional[int] = 100, cursor: Optional[str] = None) -> List[Dict]: """Fetches highlighted tweets from a user's timeline. (Simulated using user's timeline as Twitter API v2 doesn't have a direct 'highlights' endpoint). Args: user_id (str): The ID of the user whose highlights are to be fetched. count (Optional[int]): Number of tweets to retrieve. Default 100. Min 5, Max 100 for get_users_tweets. cursor (Optional[str]): Pagination token for fetching the next set of results. """ client, _ = initialize_twitter_clients() # Twitter API v2 doesn't have highlights; use user timeline tweets = client.get_users_tweets(id=user_id, max_results=count, pagination_token=cursor, tweet_fields=["id", "text", "created_at"]) return [tweet.data for tweet in tweets.data]
  • Function signature defining input parameters (user_id: str, count: Optional[int], cursor: Optional[str]) and output type (List[Dict]) for schema inference.
    async def get_highlights_tweets(user_id: str, count: Optional[int] = 100, cursor: Optional[str] = None) -> List[Dict]:

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