Skip to main content
Glama
scarecr0w12

discord-mcp

get_event_info

Retrieve detailed information about Discord scheduled events by providing server and event IDs to manage server activities.

Instructions

Get detailed information about a scheduled event

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)
eventIdYesThe ID of the event

Implementation Reference

  • The core handler function that fetches detailed scheduled event information from Discord API using guild and event IDs, formats the response, handles errors with withErrorHandling, and returns JSON string.
    async ({ guildId, eventId }) => {
      const result = await withErrorHandling(async () => {
        const client = await getDiscordClient();
        const guild = await client.guilds.fetch(guildId);
        const event = await guild.scheduledEvents.fetch(eventId);
    
        return {
          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,
          creator: event.creator ? { id: event.creator.id, username: event.creator.username } : null,
          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 required parameters: guildId (server ID) and eventId.
      guildId: z.string().describe('The ID of the server (guild)'),
      eventId: z.string().describe('The ID of the event'),
    },
  • MCP server.tool registration call for 'get_event_info' tool, including name, description, input schema, and inline handler function.
    server.tool(
      'get_event_info',
      'Get detailed information about a scheduled event',
      {
        guildId: z.string().describe('The ID of the server (guild)'),
        eventId: z.string().describe('The ID of the event'),
      },
      async ({ guildId, eventId }) => {
        const result = await withErrorHandling(async () => {
          const client = await getDiscordClient();
          const guild = await client.guilds.fetch(guildId);
          const event = await guild.scheduledEvents.fetch(eventId);
    
          return {
            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,
            creator: event.creator ? { id: event.creator.id, username: event.creator.username } : null,
            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 in the main MCP server setup, which registers the get_event_info tool along with other event tools.
    registerEventTools(server);
  • Import of withErrorHandling utility used in the get_event_info handler for error management.
    import { withErrorHandling } from '../utils/error-handler.js';

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