Skip to main content
Glama
baryhuang

MCP Server - Twitter NoAuth

twitter_reply_to_tweet

Reply to any tweet on Twitter using its ID and a provided text, enabled through direct API access without local credential setup.

Instructions

Reply to an existing tweet

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesThe reply text content
tweet_idYesID of the tweet to reply to
twitter_access_tokenYesTwitter OAuth2 access token

Implementation Reference

  • Core handler function in TwitterClient that executes the reply logic: validates token, constructs POST request to Twitter API /tweets with in_reply_to_tweet_id, handles response and errors.
    def reply_to_tweet(self, tweet_id: str, text: str) -> str:
        """Reply to an existing tweet
        
        Args:
            tweet_id: ID of the tweet to reply to
            text: The reply text content
        """
        try:
            if not self.access_token:
                return json.dumps({
                    "error": "No valid access token provided. Please refresh your token first.",
                    "status": "error"
                })
            
            logger.debug(f"Replying to tweet {tweet_id} with text: {text[:30]}...")
            
            # Twitter API v2 create tweet (reply) endpoint
            url = f"{self.api_base_url}/tweets"
            
            headers = {
                "Authorization": f"Bearer {self.access_token}",
                "Content-Type": "application/json"
            }
            
            # Create request body with reply information
            data = {
                "text": text,
                "reply": {
                    "in_reply_to_tweet_id": tweet_id
                }
            }
            
            response = requests.post(url, headers=headers, json=data)
            response.raise_for_status()
            
            # Return the raw JSON response
            return json.dumps(response.json())
            
        except requests.exceptions.RequestException as e:
            logger.error(f"API request error: {str(e)}")
            return json.dumps({"error": str(e), "status": "error"})
        except Exception as e:
            logger.error(f"Exception in reply_to_tweet: {str(e)}")
            return json.dumps({"error": str(e), "status": "error"})
  • Tool registration in list_tools() with name, description, and input schema definition.
    types.Tool(
        name="twitter_reply_to_tweet",
        description="Reply to an existing tweet",
        inputSchema={
            "type": "object",
            "properties": {
                "twitter_access_token": {"type": "string", "description": "Twitter OAuth2 access token"},
                "tweet_id": {"type": "string", "description": "ID of the tweet to reply to"},
                "text": {"type": "string", "description": "The reply text content"}
            },
            "required": ["twitter_access_token", "tweet_id", "text"]
        },
    ),
  • Dispatch handler in MCP server's call_tool() that extracts arguments, validates inputs, instantiates TwitterClient, and invokes the reply_to_tweet method.
    elif name == "twitter_reply_to_tweet":
        tweet_id = arguments.get("tweet_id")
        text = arguments.get("text")
        
        if not tweet_id:
            raise ValueError("tweet_id is required for twitter_reply_to_tweet")
        
        if not text:
            raise ValueError("text is required for twitter_reply_to_tweet")
        
        results = twitter.reply_to_tweet(tweet_id=tweet_id, text=text)
        return [types.TextContent(type="text", text=results)]
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'Reply to' implies a write/mutation operation, the description doesn't disclose critical behavioral traits such as authentication requirements (implied by the access token parameter but not stated), rate limits, whether replies are public/private, or what happens on success/failure. For a mutation tool with zero annotation coverage, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with a single sentence ('Reply to an existing tweet') that efficiently conveys the core purpose. It's front-loaded with no wasted words, making it easy to parse quickly. Every word earns its place, though this conciseness comes at the cost of completeness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a social media write operation with no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., success confirmation, reply ID, error details), behavioral aspects like rate limits or permissions, or how it differs from sibling tools. For a 3-parameter mutation tool, this minimal description leaves too many gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds no parameter semantics beyond what the input schema provides. The schema has 100% description coverage with clear explanations for 'text', 'tweet_id', and 'twitter_access_token'. Since schema coverage is high (>80%), the baseline score is 3, as the description doesn't compensate with additional context like format examples or constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Reply to') and the resource ('an existing tweet'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'twitter_post_tweet' (which presumably posts original tweets) or 'twitter_get_user_replies' (which retrieves replies). The description is specific but lacks sibling distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to choose 'twitter_reply_to_tweet' over 'twitter_post_tweet' for posting content, nor does it indicate prerequisites like needing an access token or a valid tweet ID. There's no explicit when/when-not usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/baryhuang/mcp-twitter-noauth'

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