unban_member
Remove a user ban on Discord servers through MCP integration, allowing moderation reversal with optional reason specification.
Instructions
Remove a ban for a user.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_id | Yes | ||
| server_id | No | ||
| reason | No |
Implementation Reference
- src/discord_mcp/server.py:1308-1323 (handler)The handler function for the 'unban_member' tool. It fetches the guild and user, then calls guild.unban(user, reason) to remove the ban.async def unban_member( user_id: str | int, server_id: str | int | None = None, reason: str | None = None, ctx: Context = None, ) -> str: # type: ignore[override] """Remove a ban for a user.""" assert ctx is not None bot, config = await _acquire(ctx) guild_id = _resolve_guild_id(config, server_id) guild = await _ensure_guild(bot, guild_id) user = await _call_discord("fetch user", bot.fetch_user(_require_int(user_id, "user_id"))) await _call_discord("unban member", guild.unban(user, reason=reason)) return f"Unbanned {user.display_name} ({user.id}) from {guild.name}."