Skip to main content
Glama
crazyrabbitLTC

Twitter MCP Server

retweet

Share a tweet on Twitter by specifying its unique ID using the MCP server, enabling automated retweeting functionality for efficient content sharing.

Instructions

Retweet a tweet by its ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tweetIdYesThe ID of the tweet to retweet

Implementation Reference

  • Implementation of the retweet tool handler using Twitter API v2 to retweet a tweet by ID
    export const handleRetweet: TwitterHandler<TweetEngagementArgs> = async ( client: TwitterClient | null, { tweetId }: TweetEngagementArgs ): Promise<HandlerResponse> => { if (!client) { return createMissingTwitterApiKeyResponse('retweet'); } try { const userId = await client.v2.me().then((response: any) => response.data.id); await client.v2.retweet(userId, tweetId); return createResponse(`Successfully retweeted tweet: ${tweetId}`); } catch (error) { if (error instanceof Error) { throw new Error(formatTwitterError(error, 'retweeting')); } throw error; } };
  • Schema definition for the 'retweet' tool, specifying input parameters and description
    retweet: { description: 'Retweet a tweet by its ID', inputSchema: { type: 'object', properties: { tweetId: { type: 'string', description: 'The ID of the tweet to retweet' } }, required: ['tweetId'], }, },
  • src/index.ts:192-195 (registration)
    Tool registration in the CallToolRequestSchema handler switch statement, dispatching to handleRetweet
    case 'retweet': { const { tweetId } = request.params.arguments as { tweetId: string }; response = await handleRetweet(client, { tweetId }); break;

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