Skip to main content
Glama
vidhupv

X(Twitter) MCP Server

by vidhupv

delete_draft

Remove unwanted draft tweets or threads from your X/Twitter account to keep your drafts organized and prevent accidental posting.

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 for the delete_draft tool. Validates the input arguments, constructs the file path for the draft, checks if the draft file exists, deletes it using os.remove, logs the action, and returns a success message or raises an error.
    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)}")
  • Input schema definition for the delete_draft tool, specifying an object with a required 'draft_id' property of type string.
    inputSchema={
        "type": "object",
        "properties": {
            "draft_id": {
                "type": "string",
                "description": "ID of the draft to delete",
            },
        },
        "required": ["draft_id"],
    },
  • Registration of the delete_draft tool in the list_tools() function, 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"],
        },
    ),
  • Dispatch logic in the call_tool() function that routes calls to 'delete_draft' to the handle_delete_draft handler.
    elif name == "delete_draft":
        return await handle_delete_draft(arguments)
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 deletes drafts, implying a destructive mutation, but lacks details on permissions required, whether deletion is permanent or reversible, error conditions, or rate limits. This is a significant gap for a destructive operation.

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 with zero wasted words. It is appropriately sized and front-loaded, making it easy to parse quickly.

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 destructive tool with no annotations and no output schema, the description is incomplete. It lacks critical context like behavioral traits (e.g., permanence, permissions), error handling, or output expectations, leaving significant gaps for an agent to understand the tool's full implications.

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 input schema has 100% description coverage, with the single parameter 'draft_id' documented as 'ID of the draft to delete'. The description adds no additional meaning beyond this, such as format examples or sourcing guidance. Given the high schema coverage, a baseline score of 3 is appropriate.

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 target resource ('a draft tweet or thread'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like 'list_drafts' or 'publish_draft', but the verb 'Delete' inherently distinguishes it from those operations.

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, or relationships with sibling tools like 'publish_draft' (which might be an alternative for handling drafts).

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