Skip to main content
Glama
scarecr0w12

discord-mcp

list_events

Retrieve all scheduled events from a Discord server, including optional user participation counts, to manage and monitor server activities.

Instructions

List all scheduled events in a server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)
withUserCountNoInclude user count (default true)

Implementation Reference

  • The handler function that lists all scheduled events in a Discord server/guild. It fetches the guild, retrieves events (optionally with user count), maps event data to a structured format, handles errors using withErrorHandling, and returns a JSON-formatted text response.
    async ({ guildId, withUserCount = true }) => {
      const result = await withErrorHandling(async () => {
        const client = await getDiscordClient();
        const guild = await client.guilds.fetch(guildId);
        const events = await guild.scheduledEvents.fetch({ withUserCount });
    
        return events.map((event) => ({
          id: event.id,
          name: event.name,
          description: event.description,
          scheduledStartTime: event.scheduledStartAt?.toISOString(),
          scheduledEndTime: event.scheduledEndAt?.toISOString(),
          privacyLevel: GuildScheduledEventPrivacyLevel[event.privacyLevel],
          status: GuildScheduledEventStatus[event.status],
          entityType: GuildScheduledEventEntityType[event.entityType],
          entityId: event.entityId,
          channelId: event.channelId,
          creatorId: event.creatorId,
          userCount: event.userCount,
          location: event.entityMetadata?.location,
          image: event.coverImageURL(),
          url: event.url,
        }));
      });
    
      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 parameters for the list_events tool: required guildId (string) and optional withUserCount (boolean, defaults to true).
    {
      guildId: z.string().describe('The ID of the server (guild)'),
      withUserCount: z.boolean().optional().describe('Include user count (default true)'),
    },
  • The server.tool() call that registers the list_events tool on the MCP server, including name, description, input schema, and handler function.
    server.tool(
      'list_events',
      'List all scheduled events in a server',
      {
        guildId: z.string().describe('The ID of the server (guild)'),
        withUserCount: z.boolean().optional().describe('Include user count (default true)'),
      },
      async ({ guildId, withUserCount = true }) => {
        const result = await withErrorHandling(async () => {
          const client = await getDiscordClient();
          const guild = await client.guilds.fetch(guildId);
          const events = await guild.scheduledEvents.fetch({ withUserCount });
    
          return events.map((event) => ({
            id: event.id,
            name: event.name,
            description: event.description,
            scheduledStartTime: event.scheduledStartAt?.toISOString(),
            scheduledEndTime: event.scheduledEndAt?.toISOString(),
            privacyLevel: GuildScheduledEventPrivacyLevel[event.privacyLevel],
            status: GuildScheduledEventStatus[event.status],
            entityType: GuildScheduledEventEntityType[event.entityType],
            entityId: event.entityId,
            channelId: event.channelId,
            creatorId: event.creatorId,
            userCount: event.userCount,
            location: event.entityMetadata?.location,
            image: event.coverImageURL(),
            url: event.url,
          }));
        });
    
        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:63-63 (registration)
    Invocation of registerEventTools(server) in the main MCP server setup, which registers all event-related tools including list_events.
    registerEventTools(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 offers minimal behavioral insight. It states it lists events but doesn't describe output format (e.g., array of event objects), pagination, rate limits, permissions required, or error conditions. This leaves the agent guessing about key operational aspects.

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, direct sentence with no wasted words. It front-loads the core purpose ('List all scheduled events') and specifies the context ('in a server'), making it efficient and easy to parse.

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?

For a read operation with no annotations and no output schema, the description is insufficient. It doesn't explain what data is returned (e.g., event IDs, names, times), how results are structured, or any limitations (e.g., max events per response). This leaves significant gaps for the agent to operate effectively.

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%, so parameters are well-documented in the schema itself. The description adds no additional parameter context beyond implying 'server' relates to 'guildId'. This meets the baseline for high schema coverage but doesn't enhance understanding.

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 action ('List') and resource ('scheduled events in a server'), making the purpose immediately understandable. It doesn't explicitly differentiate from siblings like 'get_event_info' or 'get_event_subscribers', but the verb 'List all' suggests a broader scope than those specific retrieval tools.

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?

No guidance is provided on when to use this tool versus alternatives like 'get_event_info' (for details on a single event) or 'get_event_subscribers' (for participants). The description mentions 'all scheduled events' but doesn't clarify if this is the primary tool for event enumeration or if there are context-specific choices.

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