update_channel
Modify Discord channel settings including name, topic, category, permissions, and configuration parameters to organize and manage server communication.
Instructions
Update channel settings such as name, topic, and category.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channel_id | Yes | ||
| name | No | ||
| category_id | No | ||
| position | No | ||
| topic | No | ||
| nsfw | No | ||
| slowmode_delay | No | ||
| user_limit | No | ||
| bitrate | No | ||
| reason | No |
Implementation Reference
- src/discord_mcp/server.py:944-1021 (handler)The primary handler implementation for the MCP tool 'update_channel'. This FastMCP tool function fetches the Discord channel, constructs updates based on provided parameters (name, category, position, topic, nsfw, slowmode, user_limit, bitrate), validates applicability per channel type, and applies the changes via channel.edit().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}."