Skip to main content
Glama

delete_automod_rule

Remove an auto-moderation rule from a Discord server by specifying the guild ID and rule ID. This action deletes the rule permanently.

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

  • The handler function for delete_automod_rule tool. Fetches the Discord guild and auto-moderation rule, deletes the rule with optional reason, handles errors, and returns success message or error.
    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) }] }; }
  • Input schema for delete_automod_rule tool using Zod validation: guildId (required string), ruleId (required string), reason (optional string).
    { 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'), },
  • Registration of the delete_automod_rule tool on the MCP server within registerAuditTools function.
    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) }] }; } );

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