Skip to content

automod_create_rule

Category: automod

Create an AutoMod rule.

  • Add a keyword filter, spam blocker, mention-raid guard, etc.

trigger_metadata is conditional on trigger_type:

  • 1 KEYWORD → keyword_filter, regex_patterns, allow_list
  • 3 SPAM → no metadata
  • 4 KEYWORD_PRESET → presets, allow_list
  • 5 MENTION_SPAM → mention_total_limit, mention_raid_protection_enabled
  • 6 MEMBER_PROFILE → keyword_filter, regex_patterns, allow_list
FieldTypeRequiredDescription
guild_idstringyesTarget guild
namestringyesRule name
event_typeintegeryesAutoMod event type (1 MESSAGE_SEND, 2 MEMBER_UPDATE)
trigger_typeintegeryesAutoMod trigger type (1 KEYWORD, 3 SPAM, 4 KEYWORD_PRESET, 5 MENTION_SPAM, 6 MEMBER_PROFILE)
trigger_metadataobjectnoAutoMod trigger metadata (fields valid per trigger_type)
actionsarrayyesActions to take when the rule fires
enabledbooleannoWhether the rule is active (default true)
exempt_rolesarraynoRoles exempt from this rule (max 20)
exempt_channelsarraynoChannels exempt from this rule (max 50)
audit_reasonstringnoReason recorded in audit log (X-Audit-Log-Reason header)

\{id, name, trigger_type, enabled\}.

FieldTypeRequiredDescription
idstringyesDiscord AutoMod rule ID
namestringyes
trigger_typeintegeryes
enabledbooleanyes
PropertyValue
Read-onlyno
Destructiveno
Idempotentno
Open-worldyes
Confirmation requiredno

packages/mcp-core/src/tools/automod/create_rule.ts