get_event_subscribers
Retrieve users subscribed to a Discord scheduled event by providing the guild and event IDs. This tool helps manage event attendance and participant lists.
Instructions
Get users subscribed to 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 | |
| limit | No | Max users to fetch (default 100) |
Implementation Reference
- src/tools/event-tools.ts:247-278 (handler)Complete implementation of the 'get_event_subscribers' MCP tool, including registration, input schema using Zod, and handler logic that fetches Discord scheduled event subscribers using event.fetchSubscribers() with error handling.server.tool( 'get_event_subscribers', 'Get users subscribed to a scheduled event', { guildId: z.string().describe('The ID of the server (guild)'), eventId: z.string().describe('The ID of the event'), limit: z.number().optional().describe('Max users to fetch (default 100)'), }, async ({ guildId, eventId, limit = 100 }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const guild = await client.guilds.fetch(guildId); const event = await guild.scheduledEvents.fetch(eventId); const subscribers = await event.fetchSubscribers({ limit, withMember: true }); return subscribers.map((sub) => ({ id: sub.user.id, username: sub.user.username, member: sub.member ? { nickname: sub.member.nickname, joinedAt: sub.member.joinedAt?.toISOString(), } : null, })); }); 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)Main server initialization calls registerEventTools(server), which registers all event management tools including 'get_event_subscribers'.registerEventTools(server);
- src/index.ts:20-20 (registration)Imports the registerEventTools function used to register the event tools module containing 'get_event_subscribers'.import { registerEventTools } from './tools/event-tools.js';