Skip to main content
Glama
cjkcr

X(Twitter) MCP Server

by cjkcr

delete_draft

Remove unwanted draft tweets or threads from your X/Twitter account by specifying the draft ID to free up space and maintain organized draft management.

Instructions

Delete a draft tweet or thread

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
draft_idYesID of the draft to delete

Implementation Reference

  • The main handler function that executes the delete_draft tool: validates input, constructs draft file path, checks existence, removes the file, logs the action, and returns a success message.
    async def handle_delete_draft(arguments: Any) -> Sequence[TextContent]:
        if not isinstance(arguments, dict) or "draft_id" not in arguments:
            raise ValueError("Invalid arguments for delete_draft")
        
        draft_id = arguments["draft_id"]
        filepath = os.path.join("drafts", draft_id)
        
        try:
            if not os.path.exists(filepath):
                raise ValueError(f"Draft {draft_id} does not exist")
            
            os.remove(filepath)
            logger.info(f"Deleted draft: {draft_id}")
            
            return [
                TextContent(
                    type="text",
                    text=f"Successfully deleted draft {draft_id}",
                )
            ]
        except Exception as e:
            logger.error(f"Error deleting draft {draft_id}: {str(e)}")
            raise RuntimeError(f"Error deleting draft {draft_id}: {str(e)}")
  • Registration of the 'delete_draft' tool in the MCP server's list_tools() method, including name, description, and input schema.
    Tool(
        name="delete_draft",
        description="Delete a draft tweet or thread",
        inputSchema={
            "type": "object",
            "properties": {
                "draft_id": {
                    "type": "string",
                    "description": "ID of the draft to delete",
                },
            },
            "required": ["draft_id"],
        },
    ),
  • Input schema for the delete_draft tool, defining a required 'draft_id' string parameter.
    inputSchema={
        "type": "object",
        "properties": {
            "draft_id": {
                "type": "string",
                "description": "ID of the draft to delete",
            },
        },
        "required": ["draft_id"],
    },
  • Dispatch in the main call_tool handler that routes 'delete_draft' calls to the specific handle_delete_draft function.
    elif name == "delete_draft":
        return await handle_delete_draft(arguments)
  • Supporting helper function to conditionally delete drafts on publishing failures based on AUTO_DELETE_FAILED_DRAFTS configuration.
    def delete_draft_on_failure(draft_id: str, filepath: str) -> None:
        """Delete draft file if auto-delete is enabled"""
        if AUTO_DELETE_FAILED_DRAFTS:
            try:
                os.remove(filepath)
                logger.info(f"Deleted draft {draft_id} due to publishing failure (auto-delete enabled)")
            except Exception as delete_error:
                logger.error(f"Failed to delete draft {draft_id} after publishing error: {delete_error}")
        else:
            logger.info(f"Draft {draft_id} preserved for retry (auto-delete disabled)")
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 destructive action ('Delete') but lacks critical details: whether deletion is permanent or reversible, if it requires specific permissions, what happens on success/failure, or any rate limits. This is inadequate for a mutation tool with zero annotation coverage.

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 directly states the tool's purpose without any wasted words. It's front-loaded with the core action and resource, 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 tool's destructive nature, lack of annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like permanence, permissions, or response format, nor does it relate to sibling tools. For a delete operation with such sparse structured data, more context is needed.

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 the single parameter 'draft_id' clearly documented in the schema. The description adds no additional parameter semantics beyond implying the parameter identifies the draft to delete, so it meets the baseline for high schema coverage without compensating value.

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 ('Delete') and the resource ('a draft tweet or thread'), making the purpose immediately understandable. However, it doesn't differentiate this tool from potential sibling operations like 'publish_draft' or 'list_drafts' beyond the obvious verb difference, which keeps it from a perfect score.

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 prerequisites (e.g., needing an existing draft), exclusions (e.g., not for published tweets), or comparisons to siblings like 'publish_draft' or 'list_drafts', leaving usage context entirely implicit.

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