Skip to main content
Glama
crazyrabbitLTC

Twitter MCP Server

trendingTopicsSearch

Discover trending topics and popular content on Twitter for analysis by specifying location, timeframe, and quantity to monitor social media conversations.

Instructions

Get trending topics and popular content for analysis

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
locationNoLocation for trending topics (default: "worldwide")
timeframeNoTimeframe for trending analysis (default: "hourly")
countNoNumber of trending topics to return (default: 10, max: 50)

Implementation Reference

  • The core handler function that implements the trendingTopicsSearch tool logic by querying recent popular tweets based on location, timeframe, and count parameters.
    export const handleTrendingTopicsSearch: SocialDataHandler<TrendingTopicsArgs> = async (
        _client: any,
        { location = 'worldwide', timeframe = 'hourly', count = 10 }: TrendingTopicsArgs
    ) => {
        try {
            const socialClient = getSocialDataClient();
            
            if (!socialClient) {
                return createMissingApiKeyResponse('Trending Topics Search');
            }
            
            // For trending topics, we'll search for popular recent content
            const query = `filter:popular -filter:replies`;
            const now = new Date();
            const timeOffset = timeframe === 'hourly' ? 1 : timeframe === 'daily' ? 24 : 168; // hours
            const startTime = new Date(now.getTime() - timeOffset * 60 * 60 * 1000).toISOString();
            
            const result = await socialClient.searchTweets({
                query,
                maxResults: count,
                startTime,
                endTime: now.toISOString()
            });
    
            if (!result.data || result.data.length === 0) {
                return createSocialDataResponse(`No trending topics found for ${location} (${timeframe})`);
            }
    
            return createSocialDataResponse(
                formatTweetList(result.data, `Trending Topics - ${location} (${timeframe})`)
            );
        } catch (error) {
            throw new Error(formatSocialDataError(error as Error, 'trending topics search'));
        }
    };
  • JSON schema definition for the trendingTopicsSearch tool input parameters, used for MCP tool registration.
    trendingTopicsSearch: {
        description: 'Get trending topics and popular content for analysis',
        inputSchema: {
            type: 'object',
            properties: {
                location: {
                    type: 'string',
                    description: 'Location for trending topics (default: "worldwide")'
                },
                timeframe: {
                    type: 'string',
                    enum: ['hourly', 'daily', 'weekly'],
                    description: 'Timeframe for trending analysis (default: "hourly")'
                },
                count: {
                    type: 'number',
                    description: 'Number of trending topics to return (default: 10, max: 50)',
                    minimum: 1,
                    maximum: 50
                }
            },
            required: []
        }
    },
  • src/index.ts:436-439 (registration)
    Registration and dispatch of the trendingTopicsSearch tool in the main CallToolRequestSchema switch statement.
    case 'trendingTopicsSearch': {
        const args = request.params.arguments as any;
        response = await handleTrendingTopicsSearch(client, args);
        break;
  • TypeScript type definition for TrendingTopicsArgs, matching the tool's input schema.
    export interface TrendingTopicsArgs {
        location?: string;
        timeframe?: 'hourly' | 'daily' | 'weekly';
        count?: number;
    }
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. While 'Get' implies a read-only operation, it doesn't specify whether this requires authentication, rate limits, data freshness, or what the return format looks like (e.g., list of topics with metrics). For a tool with zero annotation coverage, this is a significant gap.

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 front-loads the core purpose without unnecessary words. Every part of the sentence earns its place by specifying the action, resource, and purpose ('for analysis').

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 tool's complexity (3 parameters, no output schema, no annotations), the description is incomplete. It lacks details on behavioral traits (e.g., authentication needs, rate limits), output format, and differentiation from siblings. For a tool that likely returns structured data, more context is needed to guide effective use.

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 all three parameters thoroughly with defaults, constraints, and enums. The description adds no additional meaning beyond what the schema provides, such as explaining how 'location' affects results or what 'popular content' entails. 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 tool's purpose with a specific verb ('Get') and resource ('trending topics and popular content'), and distinguishes it from siblings by focusing on trending analysis rather than user actions or tweet retrieval. However, it doesn't explicitly differentiate from similar tools like 'getHashtagTrends' or 'trackVirality'.

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 like 'getHashtagTrends' or 'searchTweets', nor does it mention any prerequisites or exclusions. It simply states what the tool does without contextual usage information.

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