Read-only Twitter/X data lookup for tweets, users, followers, and engagement metrics.
- Nine tools cover tweet search with advanced operators, user profile lookups, follower/following lists, replies, retweets, and user discovery
- Supports advanced query syntax including keywords, from/to filters, hashtags, cashtags, engagement thresholds, date ranges, and media/link filters
- Cursor-based pagination for browsing large result sets across all endpoints
- Requires
TWITTER_API_KEYenvironment variable; respects API rate limits
๐ด Routing Rule โ Composio vs Native Twitter Tools
If the user has connected Twitter via Composio (OAuth), use Composio for account actions on their own profile:
| User intent | Use |
|---|---|
| Post a tweet / ๅๆจ | Composio TWITTER_CREATION_OF_A_POST |
| Query own profile / ๆฅ่ชๅทฑ็่ตๆ | Composio TWITTER_USER_LOOKUP_ME |
| Delete own tweet / ๅ ่ชๅทฑ็ๆจ | Composio TWITTER_POST_DELETE_BY_POST_ID |
| Lookup someone else's profile or tweets | This skill (twitter_user_info, twitter_user_tweets) |
| Search tweets about a topic | This skill (twitter_search_tweets) |
| Fetch tweets by URL or ID | This skill (twitter_get_tweets) |
Rationale: Composio uses the user's own OAuth-connected Twitter account, so it can post, delete, and access self-endpoints. This skill uses a separate API key that is read-only and cannot act on the user's behalf.
๐ด HARD LIMITS โ READ FIRST
โ CALL AT MOST 3 TWITTER TOOLS PER RESPONSE. STOP AFTER 3 CALLS. After each tool call, check: "Do I have enough data to answer?" If yes โ STOP AND REPLY. โ NEVER call
bashorwrite_filefor any twitter task โ reason inline, no scripts. โ NEVER paginate unless user explicitly asks for more โ first page is enough. โ NEVER calllunar_coin,lunar_coin_time_series, or any LunarCrush/CoinGecko tool โ Twitter sentiment ้ฎ้ขๅช็จtwitter_search_tweetsๅ็ญ๏ผไธ่ทจ skillใ โ NEVER callcoin_price,cg_trending,cg_coins_marketsโ ไปทๆ ผๆฐๆฎ่ถ ๅบ Twitter skill ่ๅดใ
๐ URL Handling โ x.com / twitter.com
โ NEVER use
web_fetchfor x.com or twitter.com URLs โ Twitter blocks scraping, you'll only get a login wall. โ ALWAYS extract the tweet ID from the URL and usetwitter_get_tweets.
| URL pattern | Extract | Tool call |
|---|---|---|
x.com/{user}/status/{id} |
tweet ID = {id} |
twitter_get_tweets(tweet_ids=["{id}"]) |
twitter.com/{user}/status/{id} |
tweet ID = {id} |
twitter_get_tweets(tweet_ids=["{id}"]) |
x.com/{user} |
username = {user} |
twitter_user_info(username="{user}") |
Example: User sends https://x.com/zerohedge/status/2042670029548794219
โ Extract ID: 2042670029548794219
โ Call: twitter_get_tweets(tweet_ids=["2042670029548794219"])
โ Never: web_fetch("https://x.com/...")
๐ก Few-Shot Examples
Q: ๆพ 3 ไธชๅ
ณไบ BTC ETF ็้ซ่ตๆจๆ๏ผๅช่ฆ ID ๅ็น่ตๆฐ
โ PLAN: 1 call twitter_search_tweets("BTC ETF min_faves:100") โ pick top 3 from results โ reply JSON
โ STOP after 1 call. Total tools: 1
Q: @elonmusk ๆ่ฟๅ็ๆจๆๅชๆก็น่ตๆๅค๏ผๅช่ฆๆฐๅญ
โ PLAN: 1 call twitter_user_tweets("elonmusk") โ find max likes in results โ reply number
โ STOP after 1 call. Total tools: 1
Q: ๆ็ดข solana ๆจๆ๏ผๆพ็น่ตๆๅค้ฃๆก็ไฝ่
โ PLAN: 1 call twitter_search_tweets("solana") โ find tweet with most likes โ extract username
โ STOP after 1 call. Total tools: 1
Q: ๅฏนๆฏ @A ๅ @B ่ฐ็ฒไธๅค๏ผๅ็็ฒไธๅค็ๆๆฐๆจๆ
โ PLAN: call twitter_user_info("A") + twitter_user_info("B") โ determine winner โ call twitter_user_tweets(winner)
โ Total tools: 3. STOP.
โก FAST PATHS (act immediately, no clarification needed)
| Trigger keywords | Action |
|---|---|
x.com or twitter.com URL with /status/{id} |
Extract tweet ID โ twitter_get_tweets(tweet_ids=["{id}"]) โ never web_fetch |
x.com or twitter.com URL with /{username} only |
Extract username โ twitter_user_info(username="{username}") |
| crypto sentiment / ๆ ็ปชๆซๆ / market mood / BTC ETH SOL ่ฎจ่ฎบ | Call twitter_search_tweets once per coin: "$BTC", "$ETH", "$SOL" โ summarize tone, no user profile lookups |
| search tweets about X | Call twitter_search_tweets with the topic |
| who is @username | Call twitter_user_info |
| what did @username post | Call twitter_user_tweets |
Tool Decision Tree
"Search for tweets about a topic" โ twitter_search_tweets
Advanced query with operators: keywords, from:user, #hashtag, $cashtag, min_faves, date ranges.
"Look up a specific tweet or set of tweets" โ twitter_get_tweets
Pass one or more tweet IDs directly.
"Who is this Twitter account?" โ twitter_user_info
Profile data: bio, follower count, tweet count, verification.
"What has this account been posting?" โ twitter_user_tweets
Recent tweets from a specific user.
"Who follows this account?" โ twitter_user_followers
List of followers for a user.
"Who does this account follow?" โ twitter_user_followings
List of accounts a user follows.
"What are people saying in reply to this tweet?" โ twitter_tweet_replies
Replies to a specific tweet by ID.
"Who retweeted this?" โ twitter_tweet_retweeters
Users who retweeted a specific tweet.
"Find accounts related to a topic" โ twitter_search_users
Search users by name or keyword.
"Read a long X article" โ twitter_get_article
Pass the article tweet ID. Returns title, preview, cover, and content blocks.
"Get full thread context" โ twitter_tweet_thread_context
One call returns parent chain + direct replies for the target tweet.
"Who quoted this tweet?" โ twitter_tweet_quote
Get quote tweets for a specific tweet ID.
"What is trending now?" โ twitter_get_trends
Get trends with optional woeid, country, category, limit.
"Crypto sentiment scan / ๆ
็ปชๆซๆ / market mood" โ twitter_search_tweets (call once per coin)
For BTC/ETH/SOL sentiment: search "$BTC", "$ETH", "$SOL" separately, then summarize tone inline.
โ NEVER call twitter_user_info, twitter_user_followers, or twitter_user_tweets during a sentiment scan โ text analysis only.
Available Tools
| Tool | Description | Key Params |
|---|---|---|
twitter_search_tweets |
Advanced tweet search | query (required), cursor |
twitter_get_tweets |
Get tweets by ID | tweet_ids (array, required) |
twitter_user_info |
User profile lookup | username (required) |
twitter_user_tweets |
User's recent tweets | username (required), cursor |
twitter_user_followers |
User's followers | username (required), cursor |
twitter_user_followings |
User's followings | username (required), cursor |
twitter_tweet_replies |
Replies to a tweet | tweet_id (required), cursor |
twitter_tweet_retweeters |
Who retweeted | tweet_id (required), cursor |
twitter_search_users |
Search for users | query (required), cursor |
twitter_get_article |
Get long-form article | tweet_id (required) |
twitter_tweet_thread_context |
Get full thread context | tweet_id (required) |
twitter_tweet_quote |
Get quote tweets | tweet_id (required), cursor |
twitter_get_trends |
Get trends | woeid, country, category, limit |
Usage Patterns
โ ๏ธ Token Budget Rules
- Sentiment scan: max 3
twitter_search_tweetscalls (one per coin), then summarize. Stop. - Account research: max 2 tool calls total unless user asks for more depth.
- Never chain more than 5 Twitter tool calls in one response.
Research an account
twitter_user_infoโ get profile, follower count, biotwitter_user_tweetsโ see what they've been postingtwitter_user_followingsโ who they follow (reveals interests)
Track a topic or token
twitter_search_tweetswith query like"$SOL min_faves:50"โ find popular tweetstwitter_search_userswith the topic โ find relevant accounts
Output Constraints (IMPORTANT for small models)
- Max 1
twitter_search_tweetscall per coin/topic โ do not repeat searches for same query. First result set is sufficient. - Max 3
twitter_user_infocalls per response โ only look up the most relevant accounts. - Never call
bashorwrite_filefor Twitter data โ reason inline directly from tool results. - Sentiment summaries: after 1 search call, summarize tone inline in 3โ5 sentences. Done.
- Pagination: only fetch next page if user explicitly asks for more results.
- After getting search results: sort/filter in your head, do not call bash to sort.
Analyze engagement on a tweet
twitter_get_tweetsโ get the tweet and its metricstwitter_tweet_repliesโ see the conversationtwitter_tweet_retweetersโ see who amplified it
Find influencers in a space
twitter_search_userswith keyword (e.g. "DeFi analyst")twitter_user_infoon top results to compare follower countstwitter_user_tweetsto check content quality
Search Query Operators
The twitter_search_tweets tool supports advanced operators:
| Operator | Example | Description |
|---|---|---|
| keyword | bitcoin |
Tweets containing the word |
| exact phrase | "ethereum merge" |
Exact phrase match |
from: |
from:elonmusk |
Tweets by a specific user |
to: |
to:elonmusk |
Tweets replying to a user |
#hashtag |
#crypto |
Tweets with hashtag |
$cashtag |
$BTC |
Tweets with cashtag |
lang: |
lang:en |
Filter by language |
has:media |
has:media |
Tweets with images/video |
has:links |
has:links |
Tweets with URLs |
is:reply |
is:reply |
Only replies |
min_faves: |
min_faves:100 |
Minimum likes |
min_retweets: |
min_retweets:50 |
Minimum retweets |
since: |
since:2024-01-01 |
Tweets after date |
until: |
until:2024-12-31 |
Tweets before date |
Combine operators: from:VitalikButerin $ETH min_faves:100 since:2024-01-01
Pagination
Most endpoints support cursor-based pagination. When a response includes a cursor value, pass it as the cursor parameter to get the next page. If no cursor is returned, you've reached the end.
Notes
- API key required: Set
TWITTER_API_KEYenvironment variable. Tools will error without it. - Read-only: These tools only retrieve data. No posting, liking, or following.
- For posting, deleting, or accessing the user's own Twitter account: use the composio skill (see
TWITTER_CREATION_OF_A_POST,TWITTER_USER_LOOKUP_ME,TWITTER_POST_DELETE_BY_POST_ID). This skill cannot act on the user's behalf. - Usernames: Always pass without the
@prefix (e.g."elonmusk"not"@elonmusk"). - Tweet IDs: Use string format for tweet IDs to avoid integer overflow issues.
- Rate limits: The API has rate limits. If you get rate-limited, wait before retrying.