Skip to main content
Glama
crazyrabbitLTC

Twitter MCP Server

unblockUser

Remove a block on a Twitter user account using their user ID or username to restore their ability to view your profile and interact with your content.

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

  • Core implementation of the unblockUser tool handler. Resolves user ID from username if needed, retrieves authenticated user ID, calls Twitter v2 unblock API, and returns success response or formatted error.
    /**
     * Unblock a previously blocked user account
     */
    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;
        }
    };
  • TypeScript interface defining the input arguments for the unblockUser handler (userId or username).
    export interface UnblockUserArgs {
        userId?: string;
        username?: string;
    }
  • MCP tool schema definition for unblockUser, including description and inputSchema for validation.
    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: []
        }
    },
  • src/index.ts:392-395 (registration)
    Registration and dispatching of the unblockUser tool in the main MCP server request handler switch statement.
    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 of the handleUnblockUser function in the main index file.
        handleBlockUser,
        handleUnblockUser,
        handleGetBlockedUsers,
        handleMuteUser,
        handleUnmuteUser,
        handleGetMutedUsers
    } from './handlers/moderation.handlers.js';
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It implies a mutation ('Unblock') but doesn't disclose behavioral traits such as required permissions, whether the action is reversible, rate limits, or what happens if the user isn't blocked. This is inadequate for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste, front-loaded with the core action. It's appropriately sized for the tool's purpose, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given this is a mutation tool with no annotations, no output schema, and 2 parameters, the description is incomplete. It lacks behavioral details (e.g., effects, error cases), usage context, and doesn't compensate for the absence of structured data, leaving gaps for an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents both parameters (userId and username). The description adds no meaning beyond what the schema provides, not explaining parameter relationships (e.g., use one or both) or additional context. Baseline 3 is appropriate as the schema handles parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Unblock') and target resource ('a previously blocked user account'), providing specific verb+resource. However, it doesn't differentiate from sibling tools like 'blockUser' or 'unmuteUser' beyond the obvious name difference, missing explicit distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'unmuteUser' or 'blockUser', nor does it mention prerequisites (e.g., user must be blocked first) or context for selection among sibling tools. It states the action but lacks usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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