Skip to main content
Glama
crazyrabbitLTC

Twitter MCP Server

unlikeTweet

Remove your like from a specific tweet on Twitter by providing the tweet ID. This tool integrates with the Twitter MCP Server to manage interactions with tweets.

Instructions

Unlike a previously liked tweet

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tweetIdYesThe ID of the tweet to unlike

Implementation Reference

  • Core handler function that executes the unlikeTweet tool: checks for Twitter client, retrieves authenticated user ID, calls Twitter API v2 unlike endpoint, returns success message or formatted error.
    export const handleUnlikeTweet: TwitterHandler<TweetEngagementArgs> = async ( client: TwitterClient | null, { tweetId }: TweetEngagementArgs ): Promise<HandlerResponse> => { if (!client) { return createMissingTwitterApiKeyResponse('unlikeTweet'); } try { const userId = await client.v2.me().then((response: any) => response.data.id); await client.v2.unlike(userId, tweetId); return createResponse(`Successfully unliked tweet: ${tweetId}`); } catch (error) { if (error instanceof Error) { throw new Error(formatTwitterError(error, 'unliking tweet')); } throw error; } };
  • Tool schema definition including description and input schema (requires tweetId string) used for tool listing and validation.
    unlikeTweet: { description: 'Unlike a previously liked tweet', inputSchema: { type: 'object', properties: { tweetId: { type: 'string', description: 'The ID of the tweet to unlike' } }, required: ['tweetId'], }, },
  • src/index.ts:187-190 (registration)
    Tool dispatch/registration in the main CallToolRequestSchema handler switch statement, extracts tweetId from arguments and calls the handler.
    case 'unlikeTweet': { const { tweetId } = request.params.arguments as { tweetId: string }; response = await handleUnlikeTweet(client, { tweetId }); break;
  • TypeScript interface defining the input arguments for unlikeTweet (tweetId: string).
    export interface UnlikeTweetArgs { tweetId: string; }
  • Runtime assertion function to validate unlikeTweet arguments, ensuring tweetId is present and a string.
    export function assertUnlikeTweetArgs(args: unknown): asserts args is UnlikeTweetArgs { 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'); } }

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