delete_event
Remove scheduled Discord events from your server by providing the guild ID and event ID to cancel planned activities.
Instructions
Delete 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 to delete |
Implementation Reference
- src/tools/event-tools.ts:226-243 (handler)The handler function that performs the actual deletion of the Discord scheduled event using the Discord client. It fetches the guild and event, deletes the event, and handles errors with withErrorHandling.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); const eventName = event.name; await event.delete(); return { eventId, eventName, message: 'Event deleted successfully' }; }); 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:222-225 (schema)Zod schema defining the input parameters: guildId and eventId for the delete_event tool.{ guildId: z.string().describe('The ID of the server (guild)'), eventId: z.string().describe('The ID of the event to delete'), },
- src/tools/event-tools.ts:219-244 (registration)The server.tool call that registers the 'delete_event' tool with name, description, schema, and handler function.server.tool( 'delete_event', 'Delete a scheduled event', { guildId: z.string().describe('The ID of the server (guild)'), eventId: z.string().describe('The ID of the event to delete'), }, 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); const eventName = event.name; await event.delete(); return { eventId, eventName, message: 'Event deleted successfully' }; }); 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)Top-level registration call that invokes registerEventTools to set up all event tools including delete_event.registerEventTools(server);
- src/index.ts:20-20 (registration)Import of the registerEventTools function from event-tools.ts.import { registerEventTools } from './tools/event-tools.js';