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
| 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)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'); } }
- src/tools.ts:344-354 (schema)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;
- src/handlers/list.handlers.ts:24-27 (schema)TypeScript interface defining the arguments for the handler (listId and userId).export interface RemoveUserFromListArgs { listId: string; userId: string; }