Skip to main content
Glama
vidhupv

X(Twitter) MCP Server

by vidhupv

create_draft_thread

Create draft tweet threads for X/Twitter by providing multiple tweet contents as an array, preparing content for review before publishing.

Instructions

Create a draft tweet thread

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentsYesAn array of tweet contents for the thread

Implementation Reference

  • The main handler function that executes the create_draft_thread tool. It validates the input arguments, creates a JSON file for the draft thread in the 'drafts' directory, and returns a TextContent response with the draft ID.
    async def handle_create_draft_thread(arguments: Any) -> Sequence[TextContent]:
        if not isinstance(arguments, dict) or "contents" not in arguments:
            raise ValueError("Invalid arguments for create_draft_thread")
        contents = arguments["contents"]
        if not isinstance(contents, list) or not all(isinstance(item, str) for item in contents):
            raise ValueError("Invalid contents for create_draft_thread")
        try:
            draft = {"contents": contents, "timestamp": datetime.now().isoformat()}
            # Ensure drafts directory exists
            os.makedirs("drafts", exist_ok=True)
            # Save the draft to a file
            draft_id = f"thread_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 thread created: {draft_id}")
            return [
                TextContent(
                    type="text",
                    text=f"Draft thread created with ID {draft_id}",
                )
            ]
        except Exception as e:
            logger.error(f"Error creating draft thread: {str(e)}")
            raise RuntimeError(f"Error creating draft thread: {str(e)}")
  • Tool registration in the list_tools() function, defining the name, description, and input schema for create_draft_thread.
    Tool(
        name="create_draft_thread",
        description="Create a draft tweet thread",
        inputSchema={
            "type": "object",
            "properties": {
                "contents": {
                    "type": "array",
                    "items": {"type": "string"},
                    "description": "An array of tweet contents for the thread",
                },
            },
            "required": ["contents"],
        },
    ),
  • Input schema definition for the create_draft_thread tool, specifying an object with a required 'contents' array of strings.
        "type": "object",
        "properties": {
            "contents": {
                "type": "array",
                "items": {"type": "string"},
                "description": "An array of tweet contents for the thread",
            },
        },
        "required": ["contents"],
    },
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. While 'Create' implies a write/mutation operation, the description doesn't address important behavioral aspects like whether this requires authentication, what happens if the thread exceeds platform limits, whether drafts are saved automatically, or what the expected response format is. The description provides minimal behavioral context beyond the basic action.

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 at just three words ('Create a draft tweet thread'), making it front-loaded and efficient. Every word contributes meaning, with zero wasted text or unnecessary elaboration. This is an excellent example of minimal yet complete phrasing for the core purpose.

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?

For a mutation tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what happens after creation (e.g., does it return a draft ID?), what validation occurs on the contents, whether there are length/format constraints, or how this interacts with other draft management tools. The description provides only the most basic functional information without necessary operational context.

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 doesn't provide any parameter information beyond what's already in the schema (which has 100% coverage). The schema clearly documents that 'contents' is a required array of strings for tweet contents. Since schema coverage is complete, the baseline score of 3 is appropriate - the description adds no additional parameter semantics but doesn't need to compensate for schema gaps.

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') and resource ('draft tweet thread'), making the purpose immediately understandable. However, it doesn't explicitly differentiate this tool from its sibling 'create_draft_tweet' - both involve creating draft content, though 'thread' implies multiple tweets versus a single tweet.

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?

No guidance is provided about when to use this tool versus alternatives like 'create_draft_tweet' (for single tweets) or 'publish_draft' (for finalizing drafts). The description simply states what the tool does without any context about appropriate usage scenarios or prerequisites.

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

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