replyToTweet
Post a response to a specific tweet on Twitter using the tweet ID and reply text.
Instructions
Reply to a tweet
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tweetId | Yes | The ID of the tweet to reply to | |
| text | Yes | The text of the reply |
Implementation Reference
- src/handlers/tweet.handlers.ts:83-100 (handler)Core handler function that executes the replyToTweet tool by calling Twitter API v2.reply with the provided tweetId and text.export async function handleReplyToTweet( client: TwitterClient | null, { tweetId, text }: { tweetId: string; text: string } ): Promise<HandlerResponse> { if (!client) { return createMissingTwitterApiKeyResponse('Reply to Tweet'); } try { const tweet = await client.v2.reply(text, tweetId); return createResponse(`Successfully replied to tweet: ${tweet.data.id}`); } catch (error) { if (error instanceof Error) { throw new Error(formatTwitterError(error, 'replying to tweet')); } throw new Error('Failed to reply to tweet: Unknown error occurred'); } }
- src/tools.ts:103-119 (schema)MCP tool schema definition for replyToTweet, specifying input parameters tweetId and text.replyToTweet: { description: 'Reply to a tweet', inputSchema: { type: 'object', properties: { tweetId: { type: 'string', description: 'The ID of the tweet to reply to' }, text: { type: 'string', description: 'The text of the reply' } }, required: ['tweetId', 'text'] } },
- src/index.ts:172-175 (registration)Tool call registration and dispatch in the MCP server's CallToolRequestHandler switch case.case 'replyToTweet': { const { tweetId, text } = request.params.arguments as { tweetId: string; text: string }; response = await handleReplyToTweet(client, { tweetId, text }); break;
- src/types.ts:19-22 (schema)TypeScript interface defining the input arguments for replyToTweet.export interface ReplyToTweetArgs { tweetId: string; text: string; }