Skip to main content
Glama
cjkcr

X(Twitter) MCP Server

by cjkcr

retweet

Share an existing tweet with your followers by providing its ID, enabling content redistribution on X/Twitter through the MCP server.

Instructions

Retweet an existing tweet (simple retweet without comment)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tweet_idYesThe ID of the tweet to retweet

Implementation Reference

  • The main handler function for the 'retweet' tool. Validates input, calls tweepy.Client.retweet(tweet_id) using the write client, logs the action, and returns a success message or raises appropriate errors.
    async def handle_retweet(arguments: Any) -> Sequence[TextContent]:
        if not isinstance(arguments, dict) or "tweet_id" not in arguments:
            raise ValueError("Invalid arguments for retweet")
        
        tweet_id = arguments["tweet_id"]
        
        try:
            # Simple retweet without comment using the retweet method
            response = get_write_client().retweet(tweet_id)
            
            logger.info(f"Retweeted tweet {tweet_id}")
            
            return [
                TextContent(
                    type="text",
                    text=f"Successfully retweeted tweet {tweet_id}",
                )
            ]
        except tweepy.TweepError as e:
            logger.error(f"Twitter API error retweeting tweet {tweet_id}: {e}")
            raise RuntimeError(f"Twitter API error retweeting tweet {tweet_id}: {e}")
        except Exception as e:
            logger.error(f"Error retweeting tweet {tweet_id}: {str(e)}")
            raise RuntimeError(f"Error retweeting tweet {tweet_id}: {str(e)}")
  • Registers the 'retweet' tool in the list_tools() function, providing name, description, and input schema requiring a 'tweet_id' string.
    Tool(
        name="retweet",
        description="Retweet an existing tweet (simple retweet without comment)",
        inputSchema={
            "type": "object",
            "properties": {
                "tweet_id": {
                    "type": "string",
                    "description": "The ID of the tweet to retweet",
                },
            },
            "required": ["tweet_id"],
        },
    ),
  • Dispatches calls to the 'retweet' tool handler in the general call_tool function.
    elif name == "retweet":
        return await handle_retweet(arguments)
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. It states the action ('retweet') but doesn't disclose behavioral traits such as authentication requirements, rate limits, whether it's idempotent, what happens on success/failure, or if it requires specific permissions. The description is minimal and lacks crucial operational context.

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 a single, efficient sentence with zero waste. It's front-loaded with the core action and includes a clarifying detail ('without comment') that adds value. Every word earns its place, making it highly concise and well-structured.

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 (a write operation with no annotations and no output schema), the description is incomplete. It lacks details on behavioral aspects (e.g., auth, side effects), response handling, and error conditions. For a mutation tool in a social media context, this leaves significant gaps for an AI agent.

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?

Schema description coverage is 100%, with the parameter 'tweet_id' fully documented in the schema. The description doesn't add any meaning beyond what the schema provides (e.g., no examples, format details, or constraints). Baseline 3 is appropriate since the schema does the heavy lifting.

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

Purpose5/5

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

The description clearly states the specific action ('retweet') and resource ('an existing tweet'), and distinguishes it from siblings by specifying 'simple retweet without comment' (unlike quote_tweet which adds commentary). It uses precise language that directly communicates the tool's function.

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

Usage Guidelines4/5

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

The description provides clear context by specifying 'simple retweet without comment,' which implicitly distinguishes it from quote_tweet (which adds commentary). However, it doesn't explicitly state when to use this versus alternatives like quote_tweet or create_draft_quote_tweet, nor does it mention prerequisites or exclusions.

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

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/cjkcr/x-mcp'

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