Skip to main content
Glama
scarecr0w12

discord-mcp

list_automod_rules

Retrieve all auto-moderation rules configured in a Discord server to review content filtering settings and moderation policies.

Instructions

List all auto-moderation rules in a server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)

Implementation Reference

  • The core handler function that implements the list_automod_rules tool logic: fetches auto-moderation rules from Discord guild and serializes them to JSON.
    async ({ guildId }) => {
      const result = await withErrorHandling(async () => {
        const client = await getDiscordClient();
        const guild = await client.guilds.fetch(guildId);
        const rules = await guild.autoModerationRules.fetch();
    
        return rules.map((rule) => ({
          id: rule.id,
          name: rule.name,
          enabled: rule.enabled,
          eventType: rule.eventType,
          triggerType: rule.triggerType,
          triggerMetadata: rule.triggerMetadata,
          actions: rule.actions.map((action) => ({
            type: action.type,
            metadata: action.metadata,
          })),
          exemptRoles: rule.exemptRoles.map((r) => ({ id: r.id, name: r.name })),
          exemptChannels: rule.exemptChannels.map((c) => ({ id: c.id, name: c.name })),
          creatorId: rule.creatorId,
        }));
      });
    
      if (!result.success) {
        return { content: [{ type: 'text', text: result.error }], isError: true };
      }
    
      return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] };
    }
  • Zod input schema defining the guildId parameter for the tool.
    {
      guildId: z.string().describe('The ID of the server (guild)'),
    },
  • Registration of the list_automod_rules tool using server.tool(), including name, description, schema, and handler reference.
    // List auto-moderation rules
    server.tool(
      'list_automod_rules',
      'List all auto-moderation rules in a server',
      {
        guildId: z.string().describe('The ID of the server (guild)'),
      },
      async ({ guildId }) => {
        const result = await withErrorHandling(async () => {
          const client = await getDiscordClient();
          const guild = await client.guilds.fetch(guildId);
          const rules = await guild.autoModerationRules.fetch();
    
          return rules.map((rule) => ({
            id: rule.id,
            name: rule.name,
            enabled: rule.enabled,
            eventType: rule.eventType,
            triggerType: rule.triggerType,
            triggerMetadata: rule.triggerMetadata,
            actions: rule.actions.map((action) => ({
              type: action.type,
              metadata: action.metadata,
            })),
            exemptRoles: rule.exemptRoles.map((r) => ({ id: r.id, name: r.name })),
            exemptChannels: rule.exemptChannels.map((c) => ({ id: c.id, name: c.name })),
            creatorId: rule.creatorId,
          }));
        });
    
        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:65-65 (registration)
    Top-level registration call to registerAuditTools which includes the list_automod_rules tool among audit tools.
    registerAuditTools(server);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only states the action without behavioral details. It doesn't disclose if this is a read-only operation, what permissions are required, how results are formatted (e.g., pagination, ordering), or error conditions, leaving significant gaps for a tool that likely involves server data access.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero wasted words, front-loading the core action and resource. It's appropriately sized for a simple list operation, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete for a tool that likely returns a list of rules. It lacks details on return format (e.g., array of rule objects), error handling, or authentication needs, which are critical for an agent to use it correctly in a Discord moderation context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% for the single parameter 'guildId', so the schema already documents it fully. The description adds no additional meaning beyond implying the server context, meeting the baseline for high schema coverage without compensating value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('all auto-moderation rules in a server'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_automod_rule' (which retrieves a single rule) or 'toggle_automod_rule' (which modifies rule state), missing full sibling distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing guild ID), exclusions, or comparisons to similar tools like 'get_automod_rule' for single rules, leaving usage context implied at best.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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