Skip to main content
Glama
rafaljanicki

X (Twitter) MCP server

by rafaljanicki

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

TableJSON Schema
NameRequiredDescriptionDefault
countNo

Implementation Reference

  • 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)")
  • 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]

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