Skip to main content
Glama
cjkcr

X(Twitter) MCP Server

by cjkcr

list_drafts

Retrieve and view all saved draft tweets and threads stored in the X(Twitter) MCP Server for review and management before publishing.

Instructions

List all draft tweets and threads

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'list_drafts' tool. It lists all JSON files in the 'drafts' directory, loads their contents, and returns a JSON-formatted list of draft objects including ID and 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)}")
  • Registration of the 'list_drafts' tool within the @server.list_tools() function, including its 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": [], }, ),
  • Input schema for the 'list_drafts' tool, which is an empty object (no input parameters required).
    inputSchema={ "type": "object", "properties": {}, "required": [], }, ),
  • Dispatch/registration of the 'list_drafts' handler within the general @server.call_tool() function.
    elif name == "list_drafts": return await handle_list_drafts(arguments)

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