Skip to main content
Glama
crazyrabbitLTC

Twitter MCP Server

unblockUser

Restore access for a blocked user on Twitter by unblocking their account using their user ID or username. Facilitates reconnection via the Twitter MCP Server.

Instructions

Unblock a previously blocked user account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
userIdNoThe ID of the user to unblock
usernameNoThe username of the user to unblock (alternative to userId)

Implementation Reference

  • Main handler function that executes the unblockUser tool logic: resolves user ID if needed, calls Twitter v2 unblock API, handles errors and returns response.
    export const handleUnblockUser: TwitterHandler<UnblockUserArgs> = async ( client: TwitterClient | null, { userId, username }: UnblockUserArgs ): Promise<HandlerResponse> => { if (!client) { return createMissingTwitterApiKeyResponse('unblockUser'); } try { if (!userId && !username) { throw new Error('Either userId or username must be provided'); } let targetUserId = userId; // If username provided, get the user ID first if (username && !userId) { const userResponse = await client.v2.userByUsername(username); if (!userResponse.data) { throw new Error(`User with username '${username}' not found`); } targetUserId = userResponse.data.id; } // Get authenticated user's ID const me = await client.v2.me(); const myUserId = me.data.id; // Unblock the user const result = await client.v2.unblock(myUserId, targetUserId!); return createResponse(`Successfully unblocked user ${username || targetUserId}. Response: ${JSON.stringify(result, null, 2)}`); } catch (error) { if (error instanceof Error) { throw new Error(formatTwitterError(error, 'unblocking user')); } throw error; } };
  • MCP tool schema definition for unblockUser, including input schema with optional userId or username.
    unblockUser: { description: 'Unblock a previously blocked user account', inputSchema: { type: 'object', properties: { userId: { type: 'string', description: 'The ID of the user to unblock' }, username: { type: 'string', description: 'The username of the user to unblock (alternative to userId)' } }, required: [] } },
  • TypeScript interface defining the input arguments for the unblockUser handler.
    export interface UnblockUserArgs { userId?: string; username?: string; }
  • src/index.ts:392-395 (registration)
    Registration and dispatch logic in the main server request handler switch statement that calls the unblockUser handler.
    case 'unblockUser': { const { userId, username } = request.params.arguments as { userId?: string; username?: string }; response = await handleUnblockUser(client, { userId, username }); break;
  • src/index.ts:60-66 (registration)
    Import statement registering the handleUnblockUser function for use in the main index.ts dispatcher.
    handleBlockUser, handleUnblockUser, handleGetBlockedUsers, handleMuteUser, handleUnmuteUser, handleGetMutedUsers } from './handlers/moderation.handlers.js';

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