create_poll_tweet
Generate a tweet with an interactive poll, allowing users to vote on specified choices within a set time frame, using the X (Twitter) MCP server.
Instructions
Create a tweet with a poll
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| choices | Yes | ||
| duration_minutes | Yes | ||
| text | Yes |
Implementation Reference
- src/x_twitter_mcp/server.py:242-242 (registration)Registers the create_poll_tweet tool with the FastMCP server.@server.tool(name="create_poll_tweet", description="Create a tweet with a poll")
- src/x_twitter_mcp/server.py:243-260 (handler)The main handler function that performs rate limiting check, initializes Twitter client, constructs poll data, creates the tweet with poll using tweepy.Client.create_tweet, and returns the tweet data.async def create_poll_tweet(text: str, choices: List[str], duration_minutes: int) -> Dict: """Creates a poll tweet. Args: text (str): The question or text for the poll. choices (List[str]): A list of poll choices (2-4 choices, each max 25 characters). duration_minutes (int): Duration of the poll in minutes (min 5, max 10080 (7 days)). """ if not check_rate_limit("tweet_actions"): raise Exception("Tweet action rate limit exceeded") client, _ = initialize_twitter_clients() poll_data = { "text": text, "poll_options": choices, "poll_duration_minutes": duration_minutes } tweet = client.create_tweet(**poll_data) return tweet.data
- src/x_twitter_mcp/server.py:243-243 (schema)Type hints defining the input schema: text (str), choices (List[str]), duration_minutes (int) and output Dict.async def create_poll_tweet(text: str, choices: List[str], duration_minutes: int) -> Dict: