create_x_thread
Create and publish threaded posts on X (formerly Twitter) to share extended content through connected messages.
Instructions
Create a thread on X (formerly Twitter)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | Content of the first post |
Implementation Reference
- src/index.ts:247-280 (handler)The implementation of the create_x_thread tool, which posts content to Twitter/X via the twitterClient.
else if (request.params.name === "create_x_thread") { if (!isValidPostArgs(request.params.arguments)) { throw new McpError( ErrorCode.InvalidParams, "Invalid post arguments" ); } const { content } = request.params.arguments; try { await sleep(2000) const tweet = await twitterClient.v2.tweet(content) const threadId = tweet.data.id; const newPost: SocialMediaPost = { content, platform: "X", timestamp: new Date().toISOString(), threadId: threadId, tweetId: tweet.data.id }; this.socialMediaPosts.push(newPost); return { content: [ { type: "text", text: `Successfully created X thread: ${content}. Thread ID: ${threadId}`, }, ], }; } catch (error: any) { return { isError: true, content: [ { type: "text",