Skip to main content
Glama

modify_event

Update scheduled Discord events by changing name, description, time, location, or status to keep server activities current.

Instructions

Modify a scheduled event

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)
eventIdYesThe ID of the event
nameNoNew name
descriptionNoNew description
scheduledStartTimeNoNew start time (ISO 8601)
scheduledEndTimeNoNew end time (ISO 8601)
statusNoNew status
locationNoNew location
reasonNoReason for modifying

Implementation Reference

  • The core handler function implementing the modify_event tool. It fetches the Discord guild and event, constructs edit data from provided parameters, calls event.edit(), handles errors with withErrorHandling, and returns the result.
    async ({ guildId, eventId, name, description, scheduledStartTime, scheduledEndTime, status, location, reason }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const guild = await client.guilds.fetch(guildId); const event = await guild.scheduledEvents.fetch(eventId); const statusMap: Record<string, GuildScheduledEventStatus> = { 'SCHEDULED': GuildScheduledEventStatus.Scheduled, 'ACTIVE': GuildScheduledEventStatus.Active, 'COMPLETED': GuildScheduledEventStatus.Completed, 'CANCELED': GuildScheduledEventStatus.Canceled, }; const editData: Record<string, unknown> = {}; if (name) editData.name = name; if (description) editData.description = description; if (scheduledStartTime) editData.scheduledStartTime = scheduledStartTime; if (scheduledEndTime) editData.scheduledEndTime = scheduledEndTime; if (status) editData.status = statusMap[status]; if (location) editData.entityMetadata = { location }; if (reason) editData.reason = reason; const updated = await event.edit(editData); return { id: updated.id, name: updated.name, status: GuildScheduledEventStatus[updated.status], message: 'Event updated successfully', }; }); if (!result.success) { return { content: [{ type: 'text', text: result.error }], isError: true }; } return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] }; }
  • Input schema using Zod for validating parameters to the modify_event tool.
    { guildId: z.string().describe('The ID of the server (guild)'), eventId: z.string().describe('The ID of the event'), name: z.string().optional().describe('New name'), description: z.string().optional().describe('New description'), scheduledStartTime: z.string().optional().describe('New start time (ISO 8601)'), scheduledEndTime: z.string().optional().describe('New end time (ISO 8601)'), status: z.enum(['SCHEDULED', 'ACTIVE', 'COMPLETED', 'CANCELED']).optional().describe('New status'), location: z.string().optional().describe('New location'), reason: z.string().optional().describe('Reason for modifying'), },
  • Registration of the 'modify_event' tool via server.tool(), including name, description, schema, and handler function within the registerEventTools function.
    server.tool( 'modify_event', 'Modify a scheduled event', { guildId: z.string().describe('The ID of the server (guild)'), eventId: z.string().describe('The ID of the event'), name: z.string().optional().describe('New name'), description: z.string().optional().describe('New description'), scheduledStartTime: z.string().optional().describe('New start time (ISO 8601)'), scheduledEndTime: z.string().optional().describe('New end time (ISO 8601)'), status: z.enum(['SCHEDULED', 'ACTIVE', 'COMPLETED', 'CANCELED']).optional().describe('New status'), location: z.string().optional().describe('New location'), reason: z.string().optional().describe('Reason for modifying'), }, async ({ guildId, eventId, name, description, scheduledStartTime, scheduledEndTime, status, location, reason }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const guild = await client.guilds.fetch(guildId); const event = await guild.scheduledEvents.fetch(eventId); const statusMap: Record<string, GuildScheduledEventStatus> = { 'SCHEDULED': GuildScheduledEventStatus.Scheduled, 'ACTIVE': GuildScheduledEventStatus.Active, 'COMPLETED': GuildScheduledEventStatus.Completed, 'CANCELED': GuildScheduledEventStatus.Canceled, }; const editData: Record<string, unknown> = {}; if (name) editData.name = name; if (description) editData.description = description; if (scheduledStartTime) editData.scheduledStartTime = scheduledStartTime; if (scheduledEndTime) editData.scheduledEndTime = scheduledEndTime; if (status) editData.status = statusMap[status]; if (location) editData.entityMetadata = { location }; if (reason) editData.reason = reason; const updated = await event.edit(editData); return { id: updated.id, name: updated.name, status: GuildScheduledEventStatus[updated.status], message: 'Event updated 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)
    Invocation of registerEventTools(server) which registers the modify_event tool among other event tools on the main MCP server instance.
    registerEventTools(server);
  • src/index.ts:20-20 (registration)
    Import of registerEventTools function that defines and registers the modify_event tool.
    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