Skip to main content
Glama
rafaljanicki

X (Twitter) MCP server

by rafaljanicki

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
NameRequiredDescriptionDefault
choicesYes
duration_minutesYes
textYes

Implementation Reference

  • Registers the create_poll_tweet tool with the FastMCP server.
    @server.tool(name="create_poll_tweet", description="Create a tweet with a poll")
  • 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
  • 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:

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/rafaljanicki/x-twitter-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server