Skip to main content
Glama

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
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)
eventIdYesThe ID of the event to delete

Implementation Reference

  • 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) }] }; }
  • 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'), },
  • 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';

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