Skip to main content
Glama
crazyrabbitLTC

Twitter MCP Server

getFullThread

Reconstruct complete Twitter threads with all tweets and replies from a starting tweet ID, providing full conversation context for analysis.

Instructions

Reconstruct complete Twitter thread with all tweets and replies

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tweetIdYesThe ID of the tweet to analyze thread for
includeMetricsNoInclude engagement metrics for each tweet (default: true)

Implementation Reference

  • The primary handler function that executes the getFullThread tool. It fetches conversation tweets using SocialData client, sorts them chronologically, computes thread metrics, and formats the response.
    export const handleGetFullThread: SocialDataHandler<FullThreadArgs> = async ( _client: any, { tweetId, includeMetrics = true }: FullThreadArgs ) => { try { const socialClient = getSocialDataClient(); if (!socialClient) { return createMissingApiKeyResponse('Full Thread Analysis'); } // Search for the original tweet and related conversation const mainTweetQuery = `conversation_id:${tweetId}`; const threadResult = await socialClient.searchTweets({ query: mainTweetQuery, maxResults: 100 }); if (!threadResult.data || threadResult.data.length === 0) { // Fallback: search for replies to the tweet const repliesQuery = `to:* in_reply_to_status_id:${tweetId}`; const repliesResult = await socialClient.searchTweets({ query: repliesQuery, maxResults: 50 }); return createSocialDataResponse( formatTweetList(repliesResult.data || [], `Thread replies for tweet ${tweetId}`) ); } // Sort by creation time to reconstruct thread order const sortedThread = threadResult.data.sort((a: any, b: any) => new Date(a.tweet_created_at).getTime() - new Date(b.tweet_created_at).getTime() ); const threadAnalysis = { thread_id: tweetId, total_tweets: sortedThread.length, thread_duration: sortedThread.length > 1 ? { start: sortedThread[0]?.tweet_created_at, end: sortedThread[sortedThread.length - 1]?.tweet_created_at } : null, tweets: sortedThread.map((tweet: any) => ({ id: tweet.id_str, text: tweet.text, author: tweet.user?.screen_name, created_at: tweet.tweet_created_at, metrics: includeMetrics ? { likes: tweet.favorite_count || 0, retweets: tweet.retweet_count || 0, replies: tweet.reply_count || 0 } : undefined })) }; return createSocialDataResponse( formatAnalytics(threadAnalysis, `Full Thread Analysis for ${tweetId}`) ); } catch (error) { throw new Error(formatSocialDataError(error as Error, 'full thread analysis')); } };
  • Defines the tool description and input schema (using JSON Schema) for validating getFullThread parameters: tweetId (required string), includeMetrics (optional boolean).
    getFullThread: { description: 'Reconstruct complete Twitter thread with all tweets and replies', inputSchema: { type: 'object', properties: { tweetId: { type: 'string', description: 'The ID of the tweet to analyze thread for' }, includeMetrics: { type: 'boolean', description: 'Include engagement metrics for each tweet (default: true)' } }, required: ['tweetId'] } },

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/crazyrabbitLTC/mcp-twitter-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server