Skip to main content
Glama

modify_member

Update Discord server member properties including nickname, roles, voice settings, timeout, and channel assignment using guild and member IDs.

Instructions

Modify member properties (nickname, roles, timeout, etc.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)
memberIdYesThe ID of the member
nicknameNoNew nickname (null to remove)
rolesNoArray of role IDs to set
muteNoWhether to mute in voice
deafNoWhether to deafen in voice
channelIdNoVoice channel ID to move to
communicationDisabledUntilNoISO timestamp for timeout end
reasonNoReason for the modification

Implementation Reference

  • Executes the modify_member tool: fetches guild and member, constructs update data from parameters (nickname, roles, mute, etc.), calls member.edit(), handles errors with withErrorHandling, returns JSON response.
    const client = await getDiscordClient(); const guild = await client.guilds.fetch(guildId); const member = await guild.members.fetch(memberId); const updateData: Record<string, unknown> = {}; if (nickname !== undefined) updateData.nick = nickname; if (roles !== undefined) updateData.roles = roles; if (mute !== undefined) updateData.mute = mute; if (deaf !== undefined) updateData.deaf = deaf; if (channelId !== undefined) updateData.channel = channelId; if (communicationDisabledUntil !== undefined) { updateData.communicationDisabledUntil = communicationDisabledUntil ? new Date(communicationDisabledUntil) : null; } if (reason !== undefined) updateData.reason = reason; const updatedMember = await member.edit(updateData); return { id: updatedMember.id, displayName: updatedMember.displayName, nickname: updatedMember.nickname, message: 'Member updated successfully', }; }); if (!result.success) { return { content: [{ type: 'text', text: result.error }], isError: true }; } return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] }; } );
  • Zod schema defining input parameters for modify_member tool: guildId, memberId required; nickname, roles, mute, deaf, channelId, communicationDisabledUntil, reason optional.
    memberId: z.string().describe('The ID of the member'), nickname: z.string().optional().describe('New nickname (null to remove)'), roles: z.array(z.string()).optional().describe('Array of role IDs to set'), mute: z.boolean().optional().describe('Whether to mute in voice'), deaf: z.boolean().optional().describe('Whether to deafen in voice'), channelId: z.string().optional().describe('Voice channel ID to move to'), communicationDisabledUntil: z.string().optional().describe('ISO timestamp for timeout end'), reason: z.string().optional().describe('Reason for the modification'), }, async ({ guildId, memberId, nickname, roles, mute, deaf, channelId, communicationDisabledUntil, reason }) => { const result = await withErrorHandling(async () => {
  • Registers the 'modify_member' tool on the MCP server using server.tool(), including name, description, input schema, and handler function.
    'Modify member properties (nickname, roles, timeout, etc.)', { guildId: z.string().describe('The ID of the server (guild)'), memberId: z.string().describe('The ID of the member'), nickname: z.string().optional().describe('New nickname (null to remove)'), roles: z.array(z.string()).optional().describe('Array of role IDs to set'), mute: z.boolean().optional().describe('Whether to mute in voice'), deaf: z.boolean().optional().describe('Whether to deafen in voice'), channelId: z.string().optional().describe('Voice channel ID to move to'), communicationDisabledUntil: z.string().optional().describe('ISO timestamp for timeout end'), reason: z.string().optional().describe('Reason for the modification'), }, async ({ guildId, memberId, nickname, roles, mute, deaf, channelId, communicationDisabledUntil, reason }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const guild = await client.guilds.fetch(guildId); const member = await guild.members.fetch(memberId); const updateData: Record<string, unknown> = {}; if (nickname !== undefined) updateData.nick = nickname; if (roles !== undefined) updateData.roles = roles; if (mute !== undefined) updateData.mute = mute; if (deaf !== undefined) updateData.deaf = deaf; if (channelId !== undefined) updateData.channel = channelId; if (communicationDisabledUntil !== undefined) { updateData.communicationDisabledUntil = communicationDisabledUntil ? new Date(communicationDisabledUntil) : null; } if (reason !== undefined) updateData.reason = reason; const updatedMember = await member.edit(updateData); return { id: updatedMember.id, displayName: updatedMember.displayName, nickname: updatedMember.nickname, message: 'Member updated successfully', }; }); if (!result.success) { return { content: [{ type: 'text', text: result.error }], isError: true }; } return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] }; } ); // Kick a member
  • src/index.ts:55-55 (registration)
    Top-level registration call that invokes registerMemberTools(server), which registers the modify_member tool among others.
    registerMemberTools(server);

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/scarecr0w12/discord-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server