Skip to main content
Glama
crazyrabbitLTC

Twitter MCP Server

likeTweet

Like a tweet on Twitter using its unique ID. This tool enables users to interact with tweets by adding likes through the Twitter MCP Server.

Instructions

Like a tweet by its ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tweetIdYesThe ID of the tweet to like

Implementation Reference

  • The main handler function that executes the likeTweet tool: checks for client, gets current user ID, calls Twitter API v2.like(userId, tweetId), and returns success message or formatted error.
    export const handleLikeTweet: TwitterHandler<TweetEngagementArgs> = async (
        client: TwitterClient | null,
        { tweetId }: TweetEngagementArgs
    ): Promise<HandlerResponse> => {
        if (!client) {
            return createMissingTwitterApiKeyResponse('likeTweet');
        }
        
        try {
            const { data: { id: userId } } = await client.v2.me();
            await client.v2.like(userId, tweetId);
            return createResponse(`Successfully liked tweet: ${tweetId}`);
        } catch (error) {
            if (error instanceof Error) {
                throw new Error(formatTwitterError(error, 'liking tweet'));
            }
            throw error;
        }
    };
  • Tool schema definition for likeTweet, including description and inputSchema requiring tweetId string.
    likeTweet: {
        description: 'Like a tweet by its ID',
        inputSchema: {
            type: 'object',
            properties: {
                tweetId: { type: 'string', description: 'The ID of the tweet to like' }
            },
            required: ['tweetId'],
        },
    },
  • src/index.ts:182-185 (registration)
    Tool dispatch/registration in the main MCP server request handler: extracts tweetId from arguments and calls handleLikeTweet.
    case 'likeTweet': {
        const { tweetId } = request.params.arguments as { tweetId: string };
        response = await handleLikeTweet(client, { tweetId });
        break;
  • TypeScript interface defining input args for likeTweet: tweetId string.
    export interface LikeTweetArgs {
        tweetId: string;
    }
  • Runtime validation helper function to assert arguments match LikeTweetArgs interface.
    export function assertLikeTweetArgs(args: unknown): asserts args is LikeTweetArgs {
        if (typeof args !== 'object' || args === null) {
            throw new Error('Invalid arguments: expected object');
        }
        if (!('tweetId' in args) || typeof (args as any).tweetId !== 'string') {
            throw new Error('Invalid arguments: expected tweetId string');
        }
    }
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 'Like a tweet' implies a write/mutation operation, the description doesn't specify authentication requirements, rate limits, idempotency, error conditions, or what happens if the tweet is already liked. For a mutation tool with zero annotation coverage, this is inadequate.

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 states the core functionality without unnecessary words. It's front-loaded with the essential information ('Like a tweet'), making it immediately scannable and perfectly concise for this simple operation.

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?

For a mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the tool returns (success/failure, updated tweet object, etc.), error handling, or behavioral constraints. Given the complexity of social media APIs and the lack of structured data, more context is needed for safe and 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%, with the single parameter 'tweetId' clearly documented in the schema. The description adds no additional parameter information beyond what's in the schema (e.g., format examples, constraints). With high schema coverage, the baseline score of 3 is appropriate as 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 action ('Like') and target resource ('a tweet by its ID'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling 'unlikeTweet', but the verb 'Like' is specific enough to distinguish it from most other tweet-interaction tools like 'retweet' or 'replyToTweet'.

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. It doesn't mention prerequisites (e.g., authentication, tweet visibility), when not to use it, or how it differs from similar actions like 'retweet'. With many sibling tools for tweet interactions, this lack of context is a significant gap.

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