| name | read-tweet |
| description | Read the contents of a public X/Twitter post from a URL using the X_API_KEY environment variable. Use when the user provides an x.com or twitter.com post URL and wants the post text, author, timestamp, or related metadata fetched via the X API. |
read-tweet
Purpose
Fetch a public X post by URL with the app-only bearer token stored in X_API_KEY.
Inputs
- An
x.com or twitter.com post URL
Workflow
- Extract the post ID from the
/status/ segment.
- Use
xurl read <id> to fetch the post. xurl handles authentication automatically.
- Prefer
note_tweet text over truncated text. If the text ends with ..., re-fetch with the raw API path and note_tweet field to get the full long-form text.
- Fetch 1 post only — do not walk reply chains or make additional API calls.
Example request
xurl read 2033746732996313488
xurl "/2/tweets/2033746732996313488?tweet.fields=created_at,text,note_tweet,author_id,public_metrics,referenced_tweets,conversation_id&expansions=author_id,referenced_tweets.id,referenced_tweets.id.author_id&user.fields=username,name"
Return
-
Author:
-
URL:
-
Posted:
-
Text:
-
Include public metrics only if they matter to the task.
-
If the user asks only for the contents, return just the text unless metadata is helpful.
Failure handling
- Missing
X_API_KEY → stop and report that it is not set.
CreditsDepleted → report that the credential is valid but has no remaining read credits.
404, protected, or otherwise inaccessible → report that the post is unavailable instead of guessing.