list_drafts
Retrieve saved draft tweets and threads for review or editing before publishing on X/Twitter.
Instructions
List all draft tweets and threads
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/x_mcp/server.py:182-199 (handler)The handler function that lists all draft tweets and threads by reading JSON files from the 'drafts' directory and returning their details as a JSON-formatted text content.async def handle_list_drafts(arguments: Any) -> Sequence[TextContent]: try: drafts = [] if os.path.exists("drafts"): for filename in os.listdir("drafts"): filepath = os.path.join("drafts", filename) with open(filepath, "r") as f: draft = json.load(f) drafts.append({"id": filename, "draft": draft}) return [ TextContent( type="text", text=json.dumps(drafts, indent=2), ) ] except Exception as e: logger.error(f"Error listing drafts: {str(e)}") raise RuntimeError(f"Error listing drafts: {str(e)}")
- src/x_mcp/server.py:78-86 (schema)The tool schema definition including name, description, and empty input schema (no parameters required).Tool( name="list_drafts", description="List all draft tweets and threads", inputSchema={ "type": "object", "properties": {}, "required": [], }, ),
- src/x_mcp/server.py:124-125 (registration)The dispatch logic in the call_tool handler that routes 'list_drafts' tool calls to the specific handle_list_drafts function.elif name == "list_drafts": return await handle_list_drafts(arguments)