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)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

C2.9/5.0
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.