Context
Stub is at `internal/tools/social/twitter/tool.go`. All methods return `ErrNotImplemented`. `IsEnabled() = false`.
Tools to implement
| Tool |
Description |
| `twitter_search` |
Search recent tweets (last 7 days on free tier) |
| `twitter_timeline` |
Fetch a user's recent tweets |
| `twitter_tweet` |
Post a tweet |
| `twitter_thread` |
Post a connected thread of tweets |
Auth + cost reality check
Free tier (2025):
- Bearer token only → read-only search, last 7 days, 500k tweets/month
- Write: 1,500 tweets/month app-wide, 300/user/day
- No user lookup by username without Basic tier
Basic tier ($100/month):
- Full user lookup, 2M tweet reads/month, better rate limits
Recommendation: implement search (bearer token, free) first. Gate write tools behind a `TWITTER_API_KEY` check in `IsEnabled()`.
API
Twitter API v2: `https://api.twitter.com/2/\`
Endpoints:
- `GET /2/tweets/search/recent?query=&max_results=` — recent search (bearer)
- `GET /2/users/:id/tweets` — user timeline (bearer)
- `POST /2/tweets` — create tweet (OAuth 1.0a or OAuth 2.0 user context)
Required env vars:
- `TWITTER_BEARER_TOKEN` — for read tools
- `TWITTER_API_KEY`, `TWITTER_API_SECRET`, `TWITTER_ACCESS_TOKEN`, `TWITTER_ACCESS_SECRET` — for write tools
Implementation notes
- OAuth 1.0a signing for write endpoints — use `golang.org/x/oauth1` or implement HMAC-SHA1 manually
- `twitter_tweet` and `twitter_thread` require `RequiresPermission: true`
- Thread tool: POST each tweet with `reply.in_reply_to_tweet_id` from previous
- Rate limits are strict — add backoff + 429 handling
Context
Stub is at `internal/tools/social/twitter/tool.go`. All methods return `ErrNotImplemented`. `IsEnabled() = false`.
Tools to implement
Auth + cost reality check
Free tier (2025):
Basic tier ($100/month):
Recommendation: implement search (bearer token, free) first. Gate write tools behind a `TWITTER_API_KEY` check in `IsEnabled()`.
API
Twitter API v2: `https://api.twitter.com/2/\`
Endpoints:
Required env vars:
Implementation notes