Skip to main content
Glama

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
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)
channelIdYesThe ID of the channel to modify
nameNoNew channel name
topicNoNew channel topic
nsfwNoWhether the channel is NSFW
parentIdNoNew parent category ID
positionNoNew channel position
rateLimitPerUserNoNew slowmode in seconds
bitrateNoNew bitrate (voice channels)
userLimitNoNew user limit (voice channels)
reasonNoReason for the modification

Implementation Reference

  • 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) }] }; }
  • 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'), },
  • 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);

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