Skip to main content
Glama
crazyrabbitLTC

Twitter MCP Server

removeUserFromList

Remove a Twitter user from a specified list by providing the list ID and username.

Instructions

Remove a user from a Twitter list

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
listIdYesThe ID of the list
usernameYesThe username of the user to remove

Implementation Reference

  • Core handler function that executes the removal of a user from a Twitter list using the Twitter API client. Handles missing client, calls removeListMember, and manages errors.
    export async function handleRemoveUserFromList(
        client: TwitterClient | null,
        args: RemoveUserFromListArgs
    ): Promise<HandlerResponse> {
        if (!client) {
            return createMissingTwitterApiKeyResponse('removeUserFromList');
        }
        try {
            await client.removeListMember(args.listId, args.userId);
            return createResponse(`Successfully removed user from list ${args.listId}`);
        } catch (error) {
            if (error instanceof Error) {
                throw new Error(formatTwitterError(error, 'removing user from list'));
            }
            throw new Error('Failed to remove user from list: Unknown error occurred');
        }
    }
  • MCP tool schema definition for removeUserFromList, specifying the input parameters listId and username (note: handler expects userId). This is used for tool registration.
    removeUserFromList: {
        description: 'Remove a user from a Twitter list',
        inputSchema: {
            type: 'object',
            properties: {
                listId: { type: 'string', description: 'The ID of the list' },
                username: { type: 'string', description: 'The username of the user to remove' }
            },
            required: ['listId', 'username'],
        },
    },
  • src/index.ts:294-297 (registration)
    Dispatch/registration in the main request handler switch case, mapping tool call to the handleRemoveUserFromList function.
    case 'removeUserFromList': {
        const { listId, userId } = request.params.arguments as { listId: string; userId: string };
        response = await handleRemoveUserFromList(client, { listId, userId });
        break;
  • TypeScript interface defining the arguments for the handler (listId and userId).
    export interface RemoveUserFromListArgs {
        listId: string;
        userId: string;
    }

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