Skip to main content
Glama
cjkcr

X(Twitter) MCP Server

by cjkcr

create_draft_reply

Compose a draft response to an existing X/Twitter post for review and publishing later. Specify the tweet ID to reply to and your reply content.

Instructions

Create a draft reply to an existing tweet

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesThe content of the reply tweet
reply_to_tweet_idYesThe ID of the tweet to reply to

Implementation Reference

  • The handler function that executes the 'create_draft_reply' tool. It validates input arguments, creates a JSON draft file containing the reply content, target tweet ID, timestamp, and type='reply', saves it in the 'drafts' directory with a unique ID, logs the action, and returns a success message with the draft ID.
    async def handle_create_draft_reply(arguments: Any) -> Sequence[TextContent]:
        if not isinstance(arguments, dict) or "content" not in arguments or "reply_to_tweet_id" not in arguments:
            raise ValueError("Invalid arguments for create_draft_reply")
        
        content = arguments["content"]
        reply_to_tweet_id = arguments["reply_to_tweet_id"]
        
        try:
            # Create a draft reply with the tweet ID to reply to
            draft = {
                "content": content,
                "reply_to_tweet_id": reply_to_tweet_id,
                "timestamp": datetime.now().isoformat(),
                "type": "reply"
            }
            
            # Ensure drafts directory exists
            os.makedirs("drafts", exist_ok=True)
            
            # Save the draft to a file
            draft_id = f"reply_draft_{int(datetime.now().timestamp())}.json"
            with open(os.path.join("drafts", draft_id), "w") as f:
                json.dump(draft, f, indent=2)
            
            logger.info(f"Draft reply created: {draft_id}")
            
            return [
                TextContent(
                    type="text",
                    text=f"Draft reply created with ID {draft_id} (replying to tweet {reply_to_tweet_id})",
                )
            ]
        except Exception as e:
            logger.error(f"Error creating draft reply: {str(e)}")
            raise RuntimeError(f"Error creating draft reply: {str(e)}")
  • Tool call dispatcher in the main @server.call_tool() function that routes 'create_draft_reply' calls to the specific handler function.
    elif name == "create_draft_reply":
        return await handle_create_draft_reply(arguments)
  • Registers the 'create_draft_reply' tool in @server.list_tools() with its name, description, and input schema defining required 'content' (string) and 'reply_to_tweet_id' (string) parameters.
        name="create_draft_reply",
        description="Create a draft reply to an existing tweet",
        inputSchema={
            "type": "object",
            "properties": {
                "content": {
                    "type": "string",
                    "description": "The content of the reply tweet",
                },
                "reply_to_tweet_id": {
                    "type": "string",
                    "description": "The ID of the tweet to reply to",
                },
            },
            "required": ["content", "reply_to_tweet_id"],
        },
    ),
  • Defines the input schema for the 'create_draft_reply' tool within its Tool registration, specifying an object with required string properties 'content' and 'reply_to_tweet_id'.
        name="create_draft_reply",
        description="Create a draft reply to an existing tweet",
        inputSchema={
            "type": "object",
            "properties": {
                "content": {
                    "type": "string",
                    "description": "The content of the reply tweet",
                },
                "reply_to_tweet_id": {
                    "type": "string",
                    "description": "The ID of the tweet to reply to",
                },
            },
            "required": ["content", "reply_to_tweet_id"],
        },
    ),
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool creates a draft reply, implying a write operation that doesn't publish immediately, but fails to mention critical details: whether it requires specific permissions, if drafts are saved locally or on a server, what happens on success/failure, or any rate limits. For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

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 that front-loads the core purpose without unnecessary words. Every part of the sentence earns its place by specifying the action, resource, and context. There is no redundancy or fluff, making it highly concise and well-structured for quick understanding.

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 mutation tool with no annotations and no output schema, the description is incomplete. It lacks information on behavioral traits (e.g., draft storage, error handling), usage context relative to siblings, and output details. While the schema covers parameters well, the overall context for safe and effective tool invocation is insufficient, especially compared to sibling tools that might offer similar or overlapping functionality.

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 schema description coverage is 100%, with both parameters ('content' and 'reply_to_tweet_id') clearly documented in the schema. The description adds no additional parameter semantics beyond what the schema provides, such as content length limits or tweet ID format requirements. Given the high schema coverage, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't need to given the schema's completeness.

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 ('Create a draft reply') and the resource ('to an existing tweet'), making the purpose immediately understandable. However, it doesn't explicitly differentiate this from sibling tools like 'reply_to_tweet' or 'create_draft_quote_tweet', which would require more specific language about draft vs. published replies or reply vs. quote functionality.

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 'create_draft_reply' over 'reply_to_tweet' (which might publish immediately) or 'create_draft_quote_tweet' (which creates a quote tweet draft), nor does it specify prerequisites like authentication or draft limitations. This leaves the agent without context for tool selection.

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