Skip to main content
Glama

delete_automod_rule

Remove an auto-moderation rule from a Discord server by specifying the server and rule IDs to manage content moderation settings.

Instructions

Delete an auto-moderation rule

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)
ruleIdYesThe ID of the rule to delete
reasonNoReason for deletion

Implementation Reference

  • Full implementation of the delete_automod_rule tool, including input schema (guildId, ruleId, optional reason), handler logic that uses Discord.js to fetch the guild and rule then deletes the rule with optional reason, wrapped in error handling, and returns JSON response.
    server.tool( 'delete_automod_rule', 'Delete an auto-moderation rule', { guildId: z.string().describe('The ID of the server (guild)'), ruleId: z.string().describe('The ID of the rule to delete'), reason: z.string().optional().describe('Reason for deletion'), }, async ({ guildId, ruleId, reason }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const guild = await client.guilds.fetch(guildId); const rule = await guild.autoModerationRules.fetch(ruleId); const ruleName = rule.name; await rule.delete(reason); return { ruleId, ruleName, message: 'Auto-moderation rule 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:64-64 (registration)
    Top-level registration call to registerAuditTools which registers the delete_automod_rule tool along with other audit and moderation tools.
    registerAuditTools(server);
  • Zod input schema definition for the delete_automod_rule tool parameters.
    { guildId: z.string().describe('The ID of the server (guild)'), ruleId: z.string().describe('The ID of the rule to delete'), reason: z.string().optional().describe('Reason for deletion'), },

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