undoRetweet
Remove a retweet from your Twitter account by specifying the tweet ID using this tool, allowing you to manage your retweets with precision.
Instructions
Undo a retweet by its ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tweetId | Yes | The ID of the tweet to un-retweet |
Implementation Reference
- Executes the undoRetweet tool: checks for Twitter client, gets authenticated user ID, calls Twitter API v2 unretweet(userId, tweetId), returns success message or formatted error.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; } };
- src/tools.ts:219-228 (schema)MCP tool schema definition in TOOLS object: input requires tweetId string, used for tool listing and validation.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)Tool dispatch in server.setRequestHandler(CallToolRequestSchema): extracts tweetId arg, calls handleUndoRetweet.case 'undoRetweet': { const { tweetId } = request.params.arguments as { tweetId: string }; response = await handleUndoRetweet(client, { tweetId }); break;
- src/types.ts:59-61 (schema)TypeScript interface for undoRetweet input arguments used by handler.export interface UndoRetweetArgs { tweetId: string; }