Skip to main content
Glama
crazyrabbitLTC

Twitter MCP Server

muteUser

Silence specific Twitter accounts by muting their tweets in your timeline using userId or username, ensuring a tailored social media experience.

Instructions

Mute a user account to stop seeing their tweets in your timeline

Input Schema

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

Implementation Reference

  • Core handler function for the 'muteUser' tool that resolves user ID from username if needed, authenticates, and calls Twitter API v2.mute() to mute the user.
    export const handleMuteUser: TwitterHandler<MuteUserArgs> = async ( client: TwitterClient | null, { userId, username }: MuteUserArgs ): Promise<HandlerResponse> => { if (!client) { return createMissingTwitterApiKeyResponse('muteUser'); } 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; // Mute the user const result = await client.v2.mute(myUserId, targetUserId!); return createResponse(`Successfully muted user ${username || targetUserId}. Response: ${JSON.stringify(result, null, 2)}`); } catch (error) { if (error instanceof Error) { throw new Error(formatTwitterError(error, 'muting user')); } throw error; } };
  • src/tools.ts:674-690 (registration)
    Tool registration in the TOOLS object, defining the name, description, and input schema for 'muteUser' used by MCP server for listing and validation.
    muteUser: { description: 'Mute a user account to stop seeing their tweets in your timeline', inputSchema: { type: 'object', properties: { userId: { type: 'string', description: 'The ID of the user to mute' }, username: { type: 'string', description: 'The username of the user to mute (alternative to userId)' } }, required: [] } },
  • TypeScript interface defining the input arguments for the muteUser handler (userId or username).
    export interface MuteUserArgs { userId?: string; username?: string; }
  • src/index.ts:406-409 (registration)
    Dispatch logic in the main MCP server request handler that routes 'muteUser' tool calls to the handleMuteUser function.
    case 'muteUser': { const { userId, username } = request.params.arguments as { userId?: string; username?: string }; response = await handleMuteUser(client, { userId, username }); break;

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