discord_set_role_permission
Configure Discord channel permissions for roles by allowing or denying specific actions like sending messages or viewing channels.
Instructions
Allow or deny specific permissions for a role on a channel.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channel_id | Yes | ||
| role_id | Yes | ||
| allow | No | e.g. ['SendMessages','ViewChannel'] | |
| deny | No | ||
| reason | No |
Implementation Reference
- src/tools/permissions.ts:109-116 (handler)The handler logic for "discord_set_role_permission", which updates role permission overwrites on a channel using discord.js.
case "discord_set_role_permission": { const channel = await getGuildChannel(args.channel_id as string); const options: PermissionOverwriteOptions = {}; parsePermArray(args.allow).forEach((p) => { (options as Record<string, boolean>)[p] = true; }); parsePermArray(args.deny).forEach((p) => { (options as Record<string, boolean>)[p] = false; }); await channel.permissionOverwrites.edit(args.role_id as string, options, { reason: args.reason as string | undefined }); return { content: [{ type: "text", text: `✅ Permissions updated for role ${args.role_id} on #${channel.name}.` }] }; } - src/tools/permissions.ts:16-30 (schema)The schema definition for "discord_set_role_permission", specifying the required inputs (channel_id, role_id) and optional inputs (allow, deny, reason).
{ name: "discord_set_role_permission", description: "Allow or deny specific permissions for a role on a channel.", inputSchema: { type: "object", properties: { channel_id: { type: "string" }, role_id: { type: "string" }, allow: { type: "array", items: { type: "string" }, description: "e.g. ['SendMessages','ViewChannel']" }, deny: { type: "array", items: { type: "string" } }, reason: { type: "string" }, }, required: ["channel_id", "role_id"], }, },