Skip to main content
Glama
crazyrabbitLTC

Twitter MCP Server

undoRetweet

Remove a retweet from your Twitter timeline by providing the tweet ID. This action reverses sharing while keeping the original tweet intact.

Instructions

Undo a retweet by its ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tweetIdYesThe ID of the tweet to un-retweet

Implementation Reference

  • Main handler function that performs the undoRetweet operation using Twitter API v2.unretweet after getting the authenticated user ID.
    export const handleUndoRetweet: TwitterHandler<TweetEngagementArgs> = async ( client: TwitterClient | null, { tweetId }: TweetEngagementArgs ): Promise<HandlerResponse> => { if (!client) { return createMissingTwitterApiKeyResponse('undoRetweet'); } try { const userId = await client.v2.me().then((response: any) => response.data.id); await client.v2.unretweet(userId, tweetId); return createResponse(`Successfully undid retweet: ${tweetId}`); } catch (error) { if (error instanceof Error) { throw new Error(formatTwitterError(error, 'undoing retweet')); } throw error; } };
  • MCP tool schema definition for undoRetweet, specifying the input schema requiring tweetId.
    undoRetweet: { description: 'Undo a retweet by its ID', inputSchema: { type: 'object', properties: { tweetId: { type: 'string', description: 'The ID of the tweet to un-retweet' } }, required: ['tweetId'], }, },
  • src/index.ts:197-200 (registration)
    Registration in the main CallToolRequestSchema handler switch statement, dispatching to handleUndoRetweet.
    case 'undoRetweet': { const { tweetId } = request.params.arguments as { tweetId: string }; response = await handleUndoRetweet(client, { tweetId }); break;
  • TypeScript interface defining the input arguments for undoRetweet.
    export interface UndoRetweetArgs { tweetId: string; }
  • src/index.ts:104-109 (registration)
    Registration of all tools including undoRetweet via the TOOLS object for the ListToolsRequestSchema.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: Object.entries(TOOLS).map(([name, tool]) => ({ name, ...tool })) }));

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