Skip to main content
Glama
crazyrabbitLTC

Twitter MCP Server

getTweetsByIds

Fetch multiple tweets using their unique IDs to retrieve specific content, supporting up to 100 IDs per request with optional additional fields.

Instructions

Get multiple tweets by their IDs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tweetIdsYesArray of tweet IDs to fetch
tweetFieldsNoAdditional tweet fields to include in the response

Implementation Reference

  • src/tools.ts:186-208 (registration)
    Registration of the 'getTweetsByIds' tool including description and input schema definition, used by the MCP server for tool listing.
    getTweetsByIds: {
        description: 'Get multiple tweets by their IDs',
        inputSchema: {
            type: 'object',
            properties: {
                tweetIds: { 
                    type: 'array',
                    items: { type: 'string' },
                    description: 'Array of tweet IDs to fetch',
                    maxItems: 100
                },
                tweetFields: { 
                    type: 'array', 
                    items: { 
                        type: 'string',
                        enum: ['created_at', 'author_id', 'conversation_id', 'public_metrics', 'entities', 'context_annotations']
                    },
                    description: 'Additional tweet fields to include in the response'
                },
            },
            required: ['tweetIds'],
        },
    },
  • TypeScript interface defining the input arguments for the getTweetsByIds tool.
    export interface GetTweetsByIdsArgs {
        tweetIds: string[];
        tweetFields?: string[];
    }
  • Runtime validation function for GetTweetsByIdsArgs input parameters, ensuring tweetIds is a non-empty array of up to 100 strings and tweetFields is optional array of strings.
    export function assertGetTweetsByIdsArgs(args: unknown): asserts args is GetTweetsByIdsArgs {
        if (typeof args !== 'object' || args === null) {
            throw new Error('Invalid arguments: expected object');
        }
        if (!('tweetIds' in args) || !Array.isArray((args as any).tweetIds)) {
            throw new Error('Invalid arguments: expected tweetIds array');
        }
        if ((args as any).tweetIds.length === 0) {
            throw new Error('Invalid arguments: tweetIds array cannot be empty');
        }
        if ((args as any).tweetIds.length > 100) {
            throw new Error('Invalid arguments: cannot fetch more than 100 tweets at once');
        }
        for (const id of (args as any).tweetIds) {
            if (typeof id !== 'string') {
                throw new Error('Invalid arguments: expected tweetIds to be an array of strings');
            }
        }
        if ('tweetFields' in args) {
            if (!Array.isArray((args as any).tweetFields)) {
                throw new Error('Invalid arguments: expected tweetFields to be an array');
            }
            for (const field of (args as any).tweetFields) {
                if (typeof field !== 'string') {
                    throw new Error('Invalid arguments: expected tweetFields to be an array of strings');
                }
            }
        }
    }
  • src/index.ts:104-109 (registration)
    MCP server registration of all tools from TOOLS object, including getTweetsByIds, for the ListTools request.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
        tools: Object.entries(TOOLS).map(([name, tool]) => ({
            name,
            ...tool
        }))
    }));
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the core action but omits critical details: it doesn't mention rate limits, authentication requirements, error handling (e.g., for invalid IDs), or the response format (e.g., JSON structure, pagination). For a tool that fetches data, this leaves significant gaps in understanding its operational 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 front-loads the core purpose without any wasted words. It's appropriately sized for a straightforward tool, making it easy to parse and understand at a glance.

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 lack of annotations and output schema, the description is incomplete. It doesn't address behavioral aspects like rate limits or auth needs, nor does it hint at the return structure. For a tool with two parameters and no structured safety hints, more context is needed to ensure reliable agent 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%, with both parameters ('tweetIds' and 'tweetFields') well-documented in the schema itself. The description adds no additional semantic context beyond what's in the schema (e.g., it doesn't explain ID formats or field selection implications), so it meets the baseline for high schema coverage without compensating value.

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 ('Get') and resource ('multiple tweets by their IDs'), making the purpose immediately understandable. It distinguishes itself from sibling tools like 'getTweetById' (singular) and 'searchTweets' (query-based), though it doesn't explicitly mention these distinctions in the description itself.

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 'getTweetById' (for single tweets) or 'searchTweets' (for query-based retrieval). There's no mention of prerequisites, limitations, or contextual usage scenarios beyond the basic functionality.

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