modify_channel
Update Discord channel settings including name, topic, permissions, position, and slowmode to customize server organization and access control.
Instructions
Modify channel settings (name, topic, permissions, position, etc.)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| guildId | Yes | The ID of the server (guild) | |
| channelId | Yes | The ID of the channel to modify | |
| name | No | New channel name | |
| topic | No | New channel topic | |
| nsfw | No | Whether the channel is NSFW | |
| parentId | No | New parent category ID | |
| position | No | New channel position | |
| rateLimitPerUser | No | New slowmode in seconds | |
| bitrate | No | New bitrate (voice channels) | |
| userLimit | No | New user limit (voice channels) | |
| reason | No | Reason for the modification |
Implementation Reference
- src/tools/channel-tools.ts:219-251 (handler)Handler function that modifies the Discord channel by editing its properties based on provided parameters, handles errors, and returns the updated channel information.async ({ guildId, channelId, name, topic, nsfw, parentId, position, rateLimitPerUser, bitrate, userLimit, reason }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const guild = await client.guilds.fetch(guildId); const channel = await guild.channels.fetch(channelId); if (!channel) throw new Error('Channel not found'); const updateData: Record<string, unknown> = {}; if (name !== undefined) updateData.name = name; if (topic !== undefined) updateData.topic = topic; if (nsfw !== undefined) updateData.nsfw = nsfw; if (parentId !== undefined) updateData.parent = parentId; if (position !== undefined) updateData.position = position; if (rateLimitPerUser !== undefined) updateData.rateLimitPerUser = rateLimitPerUser; if (bitrate !== undefined) updateData.bitrate = bitrate; if (userLimit !== undefined) updateData.userLimit = userLimit; if (reason !== undefined) updateData.reason = reason; const updatedChannel = await channel.edit(updateData); return { id: updatedChannel.id, name: updatedChannel.name, type: ChannelType[updatedChannel.type], message: 'Channel 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) }] }; }
- src/tools/channel-tools.ts:206-218 (schema)Zod schema defining the input parameters for the modify_channel tool, including optional fields for various channel properties.{ guildId: z.string().describe('The ID of the server (guild)'), channelId: z.string().describe('The ID of the channel to modify'), name: z.string().optional().describe('New channel name'), topic: z.string().optional().describe('New channel topic'), nsfw: z.boolean().optional().describe('Whether the channel is NSFW'), parentId: z.string().optional().describe('New parent category ID'), position: z.number().optional().describe('New channel position'), rateLimitPerUser: z.number().optional().describe('New slowmode in seconds'), bitrate: z.number().optional().describe('New bitrate (voice channels)'), userLimit: z.number().optional().describe('New user limit (voice channels)'), reason: z.string().optional().describe('Reason for the modification'), },
- src/tools/channel-tools.ts:203-252 (registration)Registration of the 'modify_channel' tool using McpServer.tool() method, including name, description, input schema, and handler function.server.tool( 'modify_channel', 'Modify channel settings (name, topic, permissions, position, etc.)', { guildId: z.string().describe('The ID of the server (guild)'), channelId: z.string().describe('The ID of the channel to modify'), name: z.string().optional().describe('New channel name'), topic: z.string().optional().describe('New channel topic'), nsfw: z.boolean().optional().describe('Whether the channel is NSFW'), parentId: z.string().optional().describe('New parent category ID'), position: z.number().optional().describe('New channel position'), rateLimitPerUser: z.number().optional().describe('New slowmode in seconds'), bitrate: z.number().optional().describe('New bitrate (voice channels)'), userLimit: z.number().optional().describe('New user limit (voice channels)'), reason: z.string().optional().describe('Reason for the modification'), }, async ({ guildId, channelId, name, topic, nsfw, parentId, position, rateLimitPerUser, bitrate, userLimit, reason }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const guild = await client.guilds.fetch(guildId); const channel = await guild.channels.fetch(channelId); if (!channel) throw new Error('Channel not found'); const updateData: Record<string, unknown> = {}; if (name !== undefined) updateData.name = name; if (topic !== undefined) updateData.topic = topic; if (nsfw !== undefined) updateData.nsfw = nsfw; if (parentId !== undefined) updateData.parent = parentId; if (position !== undefined) updateData.position = position; if (rateLimitPerUser !== undefined) updateData.rateLimitPerUser = rateLimitPerUser; if (bitrate !== undefined) updateData.bitrate = bitrate; if (userLimit !== undefined) updateData.userLimit = userLimit; if (reason !== undefined) updateData.reason = reason; const updatedChannel = await channel.edit(updateData); return { id: updatedChannel.id, name: updatedChannel.name, type: ChannelType[updatedChannel.type], message: 'Channel 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) }] }; } );
- src/index.ts:54-54 (registration)Call to registerChannelTools which includes the registration of modify_channel among other channel tools.registerChannelTools(server);