Skip to main content
Glama
scarecr0w12

discord-mcp

get_automod_rule

Retrieve details of a specific auto-moderation rule in a Discord server by providing the guild ID and rule ID.

Instructions

Get details of a specific auto-moderation rule

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)
ruleIdYesThe ID of the rule

Implementation Reference

  • Executes the tool logic: fetches the auto-moderation rule by guildId and ruleId using Discord client, processes the data, handles errors with withErrorHandling, and returns JSON stringified response.
    async ({ guildId, ruleId }) => {
      const result = await withErrorHandling(async () => {
        const client = await getDiscordClient();
        const guild = await client.guilds.fetch(guildId);
        const rule = await guild.autoModerationRules.fetch(ruleId);
    
        return {
          id: rule.id,
          name: rule.name,
          enabled: rule.enabled,
          eventType: rule.eventType,
          triggerType: rule.triggerType,
          triggerMetadata: rule.triggerMetadata,
          actions: rule.actions,
          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) }] };
    }
  • Input schema using Zod for validating guildId and ruleId parameters.
    {
      guildId: z.string().describe('The ID of the server (guild)'),
      ruleId: z.string().describe('The ID of the rule'),
    },
  • Registers the 'get_automod_rule' tool on the MCP server with name, description, input schema, and handler function inside registerAuditTools.
    server.tool(
      'get_automod_rule',
      'Get details of a specific auto-moderation rule',
      {
        guildId: z.string().describe('The ID of the server (guild)'),
        ruleId: z.string().describe('The ID of the rule'),
      },
      async ({ guildId, ruleId }) => {
        const result = await withErrorHandling(async () => {
          const client = await getDiscordClient();
          const guild = await client.guilds.fetch(guildId);
          const rule = await guild.autoModerationRules.fetch(ruleId);
    
          return {
            id: rule.id,
            name: rule.name,
            enabled: rule.enabled,
            eventType: rule.eventType,
            triggerType: rule.triggerType,
            triggerMetadata: rule.triggerMetadata,
            actions: rule.actions,
            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)
    Calls registerAuditTools to register all audit tools including get_automod_rule on the MCP server instance.
    registerAuditTools(server);
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states it's a 'Get' operation, implying read-only behavior, but doesn't specify permissions required, rate limits, error conditions, or what details are returned. This leaves significant gaps for an agent to understand the tool's behavior fully.

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 that directly states the tool's purpose without unnecessary words. It's front-loaded with the core action and resource, making it easy to parse quickly.

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

Completeness3/5

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

Given the tool's moderate complexity (a read operation with two required parameters), no annotations, and no output schema, the description is minimally adequate but incomplete. It covers the basic purpose but lacks details on behavior, usage context, and return values, which are needed for full agent understanding.

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?

The input schema has 100% description coverage, clearly documenting both parameters (guildId and ruleId) with their purposes. The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline of 3 for adequate but not enhanced parameter explanation.

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 'Get' and the resource 'details of a specific auto-moderation rule', making the purpose unambiguous. However, it doesn't explicitly differentiate from its sibling 'list_automod_rules', which might be used for listing multiple rules versus getting details of a specific one.

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 like 'list_automod_rules' or other rule-related tools. It lacks context about prerequisites, such as needing to know the rule ID beforehand, or exclusions for when not to use it.

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