removeUserFromList
Remove a specified user from a Twitter list by providing the list ID and username. Streamline list management and maintain organized Twitter curation.
Instructions
Remove a user from a Twitter list
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| listId | Yes | The ID of the list | |
| username | Yes | The username of the user to remove |
Implementation Reference
- src/handlers/list.handlers.ts:180-196 (handler)The main handler function that implements the removeUserFromList tool logic. It checks for Twitter client, removes the list member using the Twitter API, and returns a success or error response.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'); } }
- src/index.ts:294-297 (registration)The dispatch case in the main server request handler that routes calls to 'removeUserFromList' to the handleRemoveUserFromList function.case 'removeUserFromList': { const { listId, userId } = request.params.arguments as { listId: string; userId: string }; response = await handleRemoveUserFromList(client, { listId, userId }); break;
- src/tools.ts:344-353 (schema)The tool registration definition including description and input schema (note: schema uses 'username' while handler expects 'userId').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/handlers/list.handlers.ts:24-27 (schema)TypeScript interface defining the input arguments for the handler (listId and userId).export interface RemoveUserFromListArgs { listId: string; userId: string; }
- src/index.ts:43-46 (registration)Import statement bringing the handleRemoveUserFromList function into the main index for use in dispatching.handleRemoveUserFromList, handleGetListMembers, handleGetUserLists } from './handlers/list.handlers.js';