createList
Generate and manage Twitter lists by defining a name, description, and privacy settings, enabling organized curation of accounts and tweets through the Twitter MCP Server.
Instructions
Create a new Twitter list
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | No | A description of the list | |
| name | Yes | The name of the list | |
| private | No | Whether the list should be private |
Implementation Reference
- src/handlers/list.handlers.ts:111-130 (handler)The core handler function that implements the 'createList' tool by validating the Twitter client and calling the Twitter API's createList method.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'); } }
- src/handlers/list.handlers.ts:13-17 (schema)TypeScript interface defining the input parameters for the createList handler.export interface CreateListArgs { name: string; description?: string; isPrivate?: boolean; }
- src/tools.ts:321-332 (registration)MCP tool registration object defining the 'createList' tool's description and JSON input schema, exported as part of TOOLS.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)Dispatch case in the main CallToolRequestSchema handler that extracts arguments and invokes the createList handler.case 'createList': { const { name, description, isPrivate } = request.params.arguments as { name: string; description?: string; isPrivate?: boolean; }; response = await handleCreateList(client, { name, description, isPrivate }); break;