Skip to main content
Glama
crazyrabbitLTC

Twitter MCP Server

unmuteUser

Restore visibility of tweets from a muted Twitter user by providing their user ID or username. This action reverses a previous mute setting.

Instructions

Unmute a previously muted user account

Input Schema

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

Implementation Reference

  • Core handler function that executes the unmuteUser tool: resolves user ID if needed, calls Twitter v2.unmute API, handles errors and returns response.
    export const handleUnmuteUser: TwitterHandler<UnmuteUserArgs> = async (
        client: TwitterClient | null,
        { userId, username }: UnmuteUserArgs
    ): Promise<HandlerResponse> => {
        if (!client) {
            return createMissingTwitterApiKeyResponse('unmuteUser');
        }
        
        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;
    
            // Unmute the user
            const result = await client.v2.unmute(myUserId, targetUserId!);
    
            return createResponse(`Successfully unmuted user ${username || targetUserId}. Response: ${JSON.stringify(result, null, 2)}`);
        } catch (error) {
            if (error instanceof Error) {
                throw new Error(formatTwitterError(error, 'unmuting user'));
            }
            throw error;
        }
    };
  • MCP tool input schema definition for unmuteUser, specifying properties userId and username.
    unmuteUser: {
        description: 'Unmute a previously muted user account',
        inputSchema: {
            type: 'object',
            properties: {
                userId: { 
                    type: 'string', 
                    description: 'The ID of the user to unmute' 
                },
                username: { 
                    type: 'string', 
                    description: 'The username of the user to unmute (alternative to userId)' 
                }
            },
            required: []
        }
    },
  • TypeScript interface defining the arguments for the unmuteUser handler.
    export interface UnmuteUserArgs {
        userId?: string;
        username?: string;
    }
  • src/index.ts:411-414 (registration)
    Dispatch case in the main tool request handler that routes 'unmuteUser' calls to handleUnmuteUser.
    case 'unmuteUser': {
        const { userId, username } = request.params.arguments as { userId?: string; username?: string };
        response = await handleUnmuteUser(client, { userId, username });
        break;
  • src/index.ts:64-66 (registration)
    Import of the handleUnmuteUser function into the main index for tool dispatching.
        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