Skip to main content
Glama
crazyrabbitLTC

Twitter MCP Server

deleteTweet

Remove a tweet from Twitter using its unique ID to manage content or correct errors.

Instructions

Delete a tweet by its ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tweetIdYesThe ID of the tweet to delete

Implementation Reference

  • The main handler function that executes the deleteTweet tool logic. It validates the Twitter client, calls the Twitter API v2 deleteTweet method, and handles errors with formatted responses.
    export async function handleDeleteTweet( client: TwitterClient | null, { tweetId }: { tweetId: string } ): Promise<HandlerResponse> { if (!client) { return createMissingTwitterApiKeyResponse('Delete Tweet'); } try { await client.v2.deleteTweet(tweetId); return createResponse(`Successfully deleted tweet: ${tweetId}`); } catch (error) { if (error instanceof Error) { throw new Error(formatTwitterError(error, 'deleting tweet')); } throw new Error('Failed to delete tweet: Unknown error occurred'); } }
  • The tool schema definition including description and input validation schema for the deleteTweet tool, used for MCP tool listing and validation.
    deleteTweet: { description: 'Delete a tweet by its ID', inputSchema: { type: 'object', properties: { tweetId: { type: 'string', description: 'The ID of the tweet to delete' } }, required: ['tweetId'] } },
  • src/index.ts:177-180 (registration)
    The switch case in the main tool call handler that routes 'deleteTweet' calls to the handleDeleteTweet function.
    case 'deleteTweet': { const { tweetId } = request.params.arguments as { tweetId: string }; response = await handleDeleteTweet(client, { tweetId }); break;
  • src/index.ts:17-21 (registration)
    Import statement that brings the handleDeleteTweet handler into the main index file for use in tool dispatching.
    handlePostTweet, handlePostTweetWithMedia, handleGetTweetById, handleReplyToTweet, handleDeleteTweet,

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