twitter

Installation
Summary

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_KEY environment variable; respects API rate limits
SKILL.md

๐Ÿ”ด 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 bash or write_file for any twitter task โ€” reason inline, no scripts. โ›” NEVER paginate unless user explicitly asks for more โ€” first page is enough. โ›” NEVER call lunar_coin, lunar_coin_time_series, or any LunarCrush/CoinGecko tool โ€” Twitter sentiment ้—ฎ้ข˜ๅช็”จ twitter_search_tweets ๅ›ž็ญ”๏ผŒไธ่ทจ skillใ€‚ โ›” NEVER call coin_price, cg_trending, cg_coins_markets โ€” ไปทๆ ผๆ•ฐๆฎ่ถ…ๅ‡บ Twitter skill ่Œƒๅ›ดใ€‚

๐Ÿ”— URL Handling โ€” x.com / twitter.com

โ›” NEVER use web_fetch for 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 use twitter_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_tweets calls (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

  1. twitter_user_info โ€” get profile, follower count, bio
  2. twitter_user_tweets โ€” see what they've been posting
  3. twitter_user_followings โ€” who they follow (reveals interests)

Track a topic or token

  1. twitter_search_tweets with query like "$SOL min_faves:50" โ€” find popular tweets
  2. twitter_search_users with the topic โ€” find relevant accounts

Output Constraints (IMPORTANT for small models)

  • Max 1 twitter_search_tweets call per coin/topic โ€” do not repeat searches for same query. First result set is sufficient.
  • Max 3 twitter_user_info calls per response โ€” only look up the most relevant accounts.
  • Never call bash or write_file for 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

  1. twitter_get_tweets โ€” get the tweet and its metrics
  2. twitter_tweet_replies โ€” see the conversation
  3. twitter_tweet_retweeters โ€” see who amplified it

Find influencers in a space

  1. twitter_search_users with keyword (e.g. "DeFi analyst")
  2. twitter_user_info on top results to compare follower counts
  3. twitter_user_tweets to 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_KEY environment 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.
Weekly Installs
4.9K
GitHub Stars
9
First Seen
Today