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']
        }
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'reconstruct' but doesn't clarify if this is a read-only operation, what permissions are needed, rate limits, or how the thread is structured in output. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without any wasted words. It's front-loaded and appropriately sized for the task, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of reconstructing a Twitter thread, no annotations, and no output schema, the description is insufficient. It doesn't explain the return format, how threads are ordered, or any limitations (e.g., depth, deleted tweets). For a tool with rich potential output and no structured guidance, more detail is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters ('tweetId' and 'includeMetrics'). The description doesn't add any meaning beyond the schema, such as explaining what 'complete Twitter thread' entails or how 'includeMetrics' affects the reconstruction. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('reconstruct') and resource ('complete Twitter thread with all tweets and replies'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'getConversationTree' or 'getThreadMetrics', which might have overlapping functionality, so it falls short of a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives such as 'getConversationTree' or 'getThreadMetrics'. It lacks context about prerequisites, exclusions, or specific scenarios where this tool is preferred, leaving the agent with minimal usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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