get_latest_timeline
Fetch tweets from your X (Twitter) home timeline to stay updated with accounts you follow. Specify the number of tweets to retrieve within the count parameter.
Instructions
Get tweets from your home timeline (Following)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/x_twitter_mcp/server.py:354-354 (registration)Registers the 'get_latest_timeline' tool using the FastMCP @server.tool decorator.
@server.tool(name="get_latest_timeline", description="Get tweets from your home timeline (Following)") - src/x_twitter_mcp/server.py:355-363 (handler)The main handler function for the 'get_latest_timeline' tool. It initializes the Twitter client and retrieves the home timeline tweets in latest order, excluding replies and retweets, up to the specified count.
async def get_latest_timeline(count: Optional[int] = 100) -> List[Dict]: """Fetches latest timeline tweets (reverse chronological order from accounts the user follows). Args: count (Optional[int]): Number of tweets to retrieve. Default 100. Min 5, Max 100 for get_home_timeline. """ client, _ = initialize_twitter_clients() tweets = client.get_home_timeline(max_results=count, tweet_fields=["id", "text", "created_at"], exclude=["replies", "retweets"]) return [tweet.data for tweet in tweets.data]