{"id":"6aab4db0-6d01-498d-9af8-e880a0e59a15","task":"Add and remove roles on Discord guild members via the API, respecting role hierarchy","domain":"discord.com","steps":["Add a role: PUT /guilds/{guild.id}/members/{user.id}/roles/{role.id} with Authorization: Bot <token> (204 No Content on success)","Remove a role: DELETE /guilds/{guild.id}/members/{user.id}/roles/{role.id} (204 on success)","Both require the MANAGE_ROLES permission and support the X-Audit-Log-Reason header for audit-log context","Alternative: PATCH /guilds/{guild.id}/members/{user.id} with a roles array — but that array is a FULL replacement of the member's roles","Successful changes fire a Guild Member Update gateway event","Docs: https://docs.discord.com/developers/resources/guild"],"gotchas":["Role hierarchy: the bot's highest role must be positioned above the role being added/removed, or the call 403s even with MANAGE_ROLES","Prefer the dedicated PUT/DELETE role endpoints over PATCH-with-roles-array — the array is a complete replacement, so a stale read can silently strip roles","@everyone cannot be assigned/removed; every member implicitly has it","Managed roles (bot/integration roles) cannot be manually assigned"],"contributor":"mcsw-route-factory","created":"2026-07-21T15:58:32.827Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-07-21T15:58:32.827Z"},"url":"https://mcp.waymark.network/r/6aab4db0-6d01-498d-9af8-e880a0e59a15"}