Skip to main content
Glama
crazyrabbitLTC

Twitter MCP Server

getBlockedUsers

Retrieve a paginated list of users you have blocked on Twitter, allowing you to review and manage your blocked accounts with customizable user fields and result limits.

Instructions

Retrieve a paginated list of users you have blocked

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
maxResultsNoMaximum number of blocked users to return (default: 100, max: 1000)
paginationTokenNoPagination token for retrieving next page of results
userFieldsNoUser fields to include in the response

Implementation Reference

  • Main handler function that implements the getBlockedUsers tool logic, fetching the authenticated user's blocked users list from Twitter API v2 using client.v2.userBlockingUsers()
    export const handleGetBlockedUsers: TwitterHandler<GetBlockedUsersArgs> = async (
        client: TwitterClient | null,
        { maxResults = 100, paginationToken, userFields }: GetBlockedUsersArgs
    ): Promise<HandlerResponse> => {
        if (!client) {
            return createMissingTwitterApiKeyResponse('getBlockedUsers');
        }
        
        try {
            // Get authenticated user's ID
            const me = await client.v2.me();
            const myUserId = me.data.id;
    
            const options: any = {
                max_results: Math.min(maxResults, 1000) // API max is 1000
            };
    
            if (paginationToken) {
                options.pagination_token = paginationToken;
            }
    
            if (userFields && userFields.length > 0) {
                options['user.fields'] = userFields.join(',');
            } else {
                // Default user fields for better response
                options['user.fields'] = 'id,name,username,public_metrics,description,verified';
            }
    
            const blockedUsers = await client.v2.userBlockingUsers(myUserId, options);
    
            // The paginator returns data nested: { data: [users], meta: {...} }
            const userData = blockedUsers.data?.data;
            const metaData = blockedUsers.data?.meta || blockedUsers.meta;
    
            if (!userData || !Array.isArray(userData) || userData.length === 0) {
                return createResponse('No blocked users found.');
            }
    
            const responseData = {
                blockedUsers: userData,
                meta: metaData
            };
    
            return createResponse(`Retrieved ${userData.length} blocked users: ${JSON.stringify(responseData, null, 2)}`);
        } catch (error) {
            if (error instanceof Error) {
                throw new Error(formatTwitterError(error, 'getting blocked users'));
            }
            throw error;
        }
    };
  • TypeScript interface defining the input arguments for the getBlockedUsers handler
    export interface GetBlockedUsersArgs {
        maxResults?: number;
        paginationToken?: string;
        userFields?: string[];
    }
  • src/tools.ts:647-673 (registration)
    MCP tool registration defining the getBlockedUsers tool with description and input schema
    getBlockedUsers: {
        description: 'Retrieve a paginated list of users you have blocked',
        inputSchema: {
            type: 'object',
            properties: {
                maxResults: { 
                    type: 'number', 
                    description: 'Maximum number of blocked users to return (default: 100, max: 1000)',
                    minimum: 1,
                    maximum: 1000
                },
                paginationToken: { 
                    type: 'string', 
                    description: 'Pagination token for retrieving next page of results' 
                },
                userFields: { 
                    type: 'array', 
                    items: { 
                        type: 'string',
                        enum: ['id', 'name', 'username', 'description', 'profile_image_url', 'public_metrics', 'verified', 'location', 'url']
                    },
                    description: 'User fields to include in the response' 
                }
            },
            required: []
        }
    },
  • src/index.ts:397-404 (registration)
    Server request handler dispatch case that routes 'getBlockedUsers' tool calls to the handleGetBlockedUsers function
    case 'getBlockedUsers': {
        const { maxResults, paginationToken, userFields } = request.params.arguments as { 
            maxResults?: number; 
            paginationToken?: string; 
            userFields?: string[] 
        };
        response = await handleGetBlockedUsers(client, { maxResults, paginationToken, userFields });
        break;
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions pagination, which is useful, but fails to describe critical traits like authentication requirements, rate limits, error conditions, or the response format. For a read operation with zero annotation coverage, this leaves significant gaps in understanding how the tool behaves.

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 that is front-loaded with the core purpose. There is no wasted language, and it immediately conveys the essential information without unnecessary elaboration.

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 the complexity of a paginated list tool with no annotations and no output schema, the description is incomplete. It lacks details on authentication, response structure, error handling, or usage context, which are crucial for an agent to invoke this tool correctly. The description does not compensate for the missing structured data.

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 all three parameters (maxResults, paginationToken, userFields). The description does not add any additional meaning beyond what the schema provides, such as explaining parameter interactions or usage examples. Baseline 3 is appropriate when the schema does the heavy lifting.

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

Purpose5/5

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

The description clearly states the specific action ('Retrieve'), resource ('paginated list of users you have blocked'), and scope ('you have blocked'), distinguishing it from sibling tools like getMutedUsers or getFollowers. It precisely communicates what the tool does without ambiguity.

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 getMutedUsers or getUserInfo, nor does it mention prerequisites such as authentication or context for blocked users. It lacks explicit when/when-not instructions or named alternatives.

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