Skip to main content
Glama

update_channel

Modify Discord channel settings including name, topic, category, slowmode, and permissions to organize and manage server communication.

Instructions

Update channel settings such as name, topic, and category.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channel_idYes
nameNo
category_idNo
positionNo
topicNo
nsfwNo
slowmode_delayNo
user_limitNo
bitrateNo
reasonNo

Implementation Reference

  • The core handler function for the 'update_channel' tool. This FastMCP tool directly implements the logic to fetch a Discord channel and apply updates to properties like name, position, category, topic, NSFW status, slowmode delay, user limit, and bitrate based on provided arguments. It includes comprehensive validation for channel types and parameter ranges. The @server.tool() decorator also serves as the registration point.
    async def update_channel( channel_id: str | int, name: str | None = None, category_id: str | int | None = None, position: int | None = None, topic: str | None = None, nsfw: bool | str | int | None = None, slowmode_delay: int | None = None, user_limit: int | None = None, bitrate: int | None = None, reason: str | None = None, ctx: Context = None, ) -> str: # type: ignore[override] """Update channel settings such as name, topic, and category.""" assert ctx is not None bot, _ = await _acquire(ctx) channel = await _call_discord( "fetch channel", bot.fetch_channel(_require_int(channel_id, "channel_id")) ) updates: dict[str, object] = {} if name is not None: new_name = name.strip() if not new_name: raise DiscordToolError("Channel name cannot be empty.") updates["name"] = new_name if position is not None: updates["position"] = int(position) if category_id is not None: if not hasattr(channel, "guild") or channel.guild is None: raise DiscordToolError("Cannot move a channel without an associated guild.") category = await _ensure_category( bot, channel.guild, _require_int(category_id, "category_id") ) updates["category"] = category if topic is not None: if isinstance(channel, (discord.TextChannel, discord.StageChannel, discord.ForumChannel)): updates["topic"] = topic else: raise DiscordToolError("Only text, forum, or stage channels support topics.") if nsfw is not None: nsfw_value = _parse_optional_bool(nsfw, "nsfw") if isinstance(channel, (discord.TextChannel, discord.StageChannel, discord.ForumChannel)): updates["nsfw"] = nsfw_value else: raise DiscordToolError("NSFW can only be set on text, forum, or stage channels.") if slowmode_delay is not None: if isinstance(channel, discord.TextChannel): updates["slowmode_delay"] = max(0, min(int(slowmode_delay), 21600)) else: raise DiscordToolError("Slowmode is only supported on text channels.") if user_limit is not None: if isinstance(channel, (discord.VoiceChannel, discord.StageChannel)): updates["user_limit"] = max(0, min(int(user_limit), 99)) else: raise DiscordToolError("User limit can only be set on voice or stage channels.") if bitrate is not None: if isinstance(channel, (discord.VoiceChannel, discord.StageChannel)): bitrate_value = int(bitrate) max_bitrate = getattr(channel.guild, "bitrate_limit", 96000) or 96000 updates["bitrate"] = max(8000, min(bitrate_value, max_bitrate)) else: raise DiscordToolError("Bitrate can only be set on voice or stage channels.") if not updates: raise DiscordToolError("Provide at least one field to update.") await _call_discord("update channel", channel.edit(reason=reason, **updates)) return f"Updated channel {channel.id}."
  • The @server.tool() decorator registers this function as the MCP tool named 'update_channel' in the FastMCP server.
    async def update_channel( channel_id: str | int, name: str | None = None, category_id: str | int | None = None, position: int | None = None, topic: str | None = None, nsfw: bool | str | int | None = None, slowmode_delay: int | None = None, user_limit: int | None = None, bitrate: int | None = None, reason: str | None = None, ctx: Context = None, ) -> str: # type: ignore[override] """Update channel settings such as name, topic, and category.""" assert ctx is not None bot, _ = await _acquire(ctx) channel = await _call_discord( "fetch channel", bot.fetch_channel(_require_int(channel_id, "channel_id")) ) updates: dict[str, object] = {} if name is not None: new_name = name.strip() if not new_name: raise DiscordToolError("Channel name cannot be empty.") updates["name"] = new_name if position is not None: updates["position"] = int(position) if category_id is not None: if not hasattr(channel, "guild") or channel.guild is None: raise DiscordToolError("Cannot move a channel without an associated guild.") category = await _ensure_category( bot, channel.guild, _require_int(category_id, "category_id") ) updates["category"] = category if topic is not None: if isinstance(channel, (discord.TextChannel, discord.StageChannel, discord.ForumChannel)): updates["topic"] = topic else: raise DiscordToolError("Only text, forum, or stage channels support topics.") if nsfw is not None: nsfw_value = _parse_optional_bool(nsfw, "nsfw") if isinstance(channel, (discord.TextChannel, discord.StageChannel, discord.ForumChannel)): updates["nsfw"] = nsfw_value else: raise DiscordToolError("NSFW can only be set on text, forum, or stage channels.") if slowmode_delay is not None: if isinstance(channel, discord.TextChannel): updates["slowmode_delay"] = max(0, min(int(slowmode_delay), 21600)) else: raise DiscordToolError("Slowmode is only supported on text channels.") if user_limit is not None: if isinstance(channel, (discord.VoiceChannel, discord.StageChannel)): updates["user_limit"] = max(0, min(int(user_limit), 99)) else: raise DiscordToolError("User limit can only be set on voice or stage channels.") if bitrate is not None: if isinstance(channel, (discord.VoiceChannel, discord.StageChannel)): bitrate_value = int(bitrate) max_bitrate = getattr(channel.guild, "bitrate_limit", 96000) or 96000 updates["bitrate"] = max(8000, min(bitrate_value, max_bitrate)) else: raise DiscordToolError("Bitrate can only be set on voice or stage channels.") if not updates: raise DiscordToolError("Provide at least one field to update.") await _call_discord("update channel", channel.edit(reason=reason, **updates)) return f"Updated channel {channel.id}."
  • Supporting handler for editing channel properties (handle_edit_channel), used by advanced implementations or routed tools like 'edit_channel' in integrated_server.py. Provides similar functionality to the primary update_channel tool.
    async def handle_edit_channel(discord_client, arguments: Dict[str, Any]) -> List[TextContent]: """Edit channel properties""" channel = await discord_client.fetch_channel(int(arguments["channel_id"])) edit_kwargs = {} changes_made = [] if "name" in arguments: edit_kwargs["name"] = arguments["name"] changes_made.append(f"Name: {arguments['name']}") if "topic" in arguments: edit_kwargs["topic"] = arguments["topic"] changes_made.append("Topic updated") if "position" in arguments: edit_kwargs["position"] = arguments["position"] changes_made.append(f"Position: {arguments['position']}") if "nsfw" in arguments: edit_kwargs["nsfw"] = arguments["nsfw"] changes_made.append(f"NSFW: {arguments['nsfw']}") if "slowmode_delay" in arguments: edit_kwargs["slowmode_delay"] = arguments["slowmode_delay"] changes_made.append(f"Slowmode: {arguments['slowmode_delay']}s") if "user_limit" in arguments and hasattr(channel, 'user_limit'): edit_kwargs["user_limit"] = arguments["user_limit"] changes_made.append(f"User limit: {arguments['user_limit']}") if "bitrate" in arguments and hasattr(channel, 'bitrate'): edit_kwargs["bitrate"] = arguments["bitrate"] changes_made.append(f"Bitrate: {arguments['bitrate']}") if edit_kwargs: await channel.edit(**edit_kwargs, reason="Channel updated via MCP") return [TextContent( type="text", text=f"Updated channel '{channel.name}':\n• " + "\n• ".join(changes_made) )]
  • Explicit input schema definition for the 'edit_channel' tool in the integrated server implementation, which mirrors update_channel functionality.
    name="edit_channel", description="Edit existing channel properties and settings", inputSchema={ "type": "object", "properties": { "channel_id": {"type": "string", "description": "Channel ID"}, "name": {"type": "string", "description": "New channel name"}, "topic": {"type": "string", "description": "New channel topic"}, "position": {"type": "number", "description": "New channel position"}, "nsfw": {"type": "boolean", "description": "Whether channel is NSFW"}, "slowmode_delay": {"type": "number", "description": "Slowmode delay in seconds"}, "user_limit": {"type": "number", "description": "User limit for voice channels"}, "bitrate": {"type": "number", "description": "Bitrate for voice channels"} }, "required": ["channel_id"] } ),

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

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