Skip to main content
Glama

modify_event

Update scheduled Discord events by changing details like name, description, time, location, or status for server management.

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

  • Handler function that executes the modify_event tool: fetches the Discord guild and event, builds an editData object from provided optional parameters (name, description, times, status, location, reason), performs event.edit(editData), and returns updated event details or error.
    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) }] }; }
  • Zod schema defining input parameters for the modify_event tool, including required guildId and eventId, and optional fields for updating event properties.
    { 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 using server.tool(), including description, input schema, and handler 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:62-62 (registration)
    Call to registerEventTools(server) which includes the registration of modify_event among other event tools.
    registerEventTools(server);

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