Skip to main content
Glama

discord_get_audit_log

Fetch Discord server audit logs to track user actions, moderation events, and administrative changes for monitoring and security purposes.

Instructions

Fetch the guild audit log (who did what and when).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guild_idYes
limitNo1–100, default 25.
action_typeNoOptional: filter by Discord action type ID.

Implementation Reference

  • The handler implementation for discord_get_audit_log, which fetches the audit log from the Discord client.
    case "discord_get_audit_log": {
      const guild = await discord.guilds.fetch(validateId(args.guild_id, "guild_id"));
      const logs = await guild.fetchAuditLogs({
        limit: Math.min(Number(args.limit ?? 25), 100),
        type: args.action_type as number | undefined,
      });
      const result = logs.entries.map((entry) => ({
        id: entry.id, action: entry.action,
        executor: entry.executor?.tag, target: entry.targetId,
        reason: entry.reason, createdAt: entry.createdAt.toISOString(),
      }));
      return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
    }
  • The tool definition (schema) for discord_get_audit_log.
    export const definitions = [
      {
        name: "discord_get_audit_log",
        description: "Fetch the guild audit log (who did what and when).",
        inputSchema: {
          type: "object",
          properties: {
            guild_id: { type: "string" },
            limit: { type: "number", description: "1–100, default 25." },
            action_type: { type: "number", description: "Optional: filter by Discord action type ID." },
          },
          required: ["guild_id"],
        },
      },

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/PaSympa/discord-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server