unmuteUser
Enable interaction with a muted Twitter user by unmuting their account. Provide the user ID or username to restore their content to your feed using the Twitter MCP Server.
Instructions
Unmute a previously muted user account
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| userId | No | The ID of the user to unmute | |
| username | No | The username of the user to unmute (alternative to userId) |
Implementation Reference
- The main handler function that implements the unmuteUser tool logic using Twitter API v2.unmute() method. Handles input validation, user ID resolution, and error handling.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; } };
- src/index.ts:411-414 (registration)Registration and dispatch for the unmuteUser tool in the main MCP server request handler switch statement.case 'unmuteUser': { const { userId, username } = request.params.arguments as { userId?: string; username?: string }; response = await handleUnmuteUser(client, { userId, username }); break;
- src/tools.ts:691-707 (schema)MCP tool schema definition for unmuteUser, including description and input schema used for tool listing and validation.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: [] } },
- src/types/handlers.ts:136-139 (schema)TypeScript interface defining the input arguments for the unmuteUser handler.export interface UnmuteUserArgs { userId?: string; username?: string; }