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
| Name | Required | Description | Default |
|---|---|---|---|
| guildId | Yes | The ID of the server (guild) | |
| eventId | Yes | The ID of the event |
Implementation Reference
- src/tools/event-tools.ts:57-88 (handler)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) }] }; }
- src/tools/event-tools.ts:54-56 (schema)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'), },
- src/tools/event-tools.ts:50-89 (registration)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);
- src/tools/event-tools.ts:5-5 (helper)Import of withErrorHandling utility used in the get_event_info handler for error management.import { withErrorHandling } from '../utils/error-handler.js';