unban_member
Remove a user ban in Discord servers. Specify the user ID to lift the ban, with optional server ID and reason parameters for moderation management.
Instructions
Remove a ban for a user.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"user_id": "<user_id>"
},
"name": "unban_member"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_id | Yes | ||
| server_id | No | ||
| reason | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/discord_mcp/server.py:1308-1323 (handler)The core handler function for the 'unban_member' tool. It fetches the guild and user, then calls guild.unban(user, reason=reason) to remove the ban, and returns a confirmation message.
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}."