Skip to main content
Glama

delete_role

Remove a role from a Discord server by specifying the server and role IDs to manage server permissions and organization.

Instructions

Delete a role from a Discord server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)
roleIdYesThe ID of the role to delete
reasonNoReason for deleting the role

Implementation Reference

  • The complete server.tool registration for 'delete_role', including schema validation and the handler function that fetches the guild and role using Discord.js and executes role.delete(reason). This is the exact implementation of the tool.
    server.tool( 'delete_role', 'Delete a role from a Discord server', { guildId: z.string().describe('The ID of the server (guild)'), roleId: z.string().describe('The ID of the role to delete'), reason: z.string().optional().describe('Reason for deleting the role'), }, async ({ guildId, roleId, reason }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const guild = await client.guilds.fetch(guildId); const role = await guild.roles.fetch(roleId); if (!role) throw new Error('Role not found'); const roleName = role.name; await role.delete(reason); return { roleId, roleName, message: 'Role deleted successfully' }; }); if (!result.success) { return { content: [{ type: 'text', text: result.error }], isError: true }; } return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] }; } );
  • src/index.ts:57-57 (registration)
    Registration call for the role-tools module in the main MCP server setup, which includes the delete_role tool.
    registerRoleTools(server);
  • Zod schema defining input parameters for the delete_role tool: required guildId and roleId, optional reason.
    { guildId: z.string().describe('The ID of the server (guild)'), roleId: z.string().describe('The ID of the role to delete'), reason: z.string().optional().describe('Reason for deleting the role'), },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/scarecr0w12/discord-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server