Skip to main content
Glama
crazyrabbitLTC

Twitter MCP Server

createList

Create a new Twitter list to organize accounts by topic or interest, specifying name, description, and privacy settings.

Instructions

Create a new Twitter list

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesThe name of the list
descriptionNoA description of the list
privateNoWhether the list should be private

Implementation Reference

  • Main handler function executing the createList tool logic: checks for Twitter client, calls client.createList, handles success/error responses.
    export async function handleCreateList(
        client: TwitterClient | null,
        args: CreateListArgs
    ): Promise<HandlerResponse> {
        if (!client) {
            return createMissingTwitterApiKeyResponse('createList');
        }
        try {
            const list = await client.createList(args.name, args.description, args.isPrivate);
            if (!list.data) {
                throw new Error('Failed to create list');
            }
            return createResponse(`Successfully created list: ${list.data.name}`);
        } catch (error) {
            if (error instanceof Error) {
                throw new Error(formatTwitterError(error, 'creating list'));
            }
            throw new Error('Failed to create list: Unknown error occurred');
        }
    }
  • MCP tool input schema definition for createList, including properties and requirements.
    createList: {
        description: 'Create a new Twitter list',
        inputSchema: {
            type: 'object',
            properties: {
                name: { type: 'string', description: 'The name of the list' },
                description: { type: 'string', description: 'A description of the list' },
                private: { type: 'boolean', description: 'Whether the list should be private' }
            },
            required: ['name'],
        },
    },
  • src/index.ts:280-287 (registration)
    Tool registration in MCP CallToolRequestHandler: extracts arguments and invokes handleCreateList.
    case 'createList': {
        const { name, description, isPrivate } = request.params.arguments as { 
            name: string;
            description?: string;
            isPrivate?: boolean;
        };
        response = await handleCreateList(client, { name, description, isPrivate });
        break;
  • TypeScript interface defining input arguments for createList handler.
    export interface CreateListArgs {
        name: string;
        description?: string;
        isPrivate?: boolean;
    }
  • TwitterClient helper method wrapping Twitter API v2 list creation with rate limit retry logic.
    async createList(name: string, description: string = '', isPrivate: boolean = false) {
        return this.withRateLimitRetry('createList', () => 
            this.v2.createList({
                name,
                description,
                private: isPrivate
            })
        );
    }

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/crazyrabbitLTC/mcp-twitter-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server