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
| Name | Required | Description | Default |
|---|---|---|---|
| guildId | Yes | The ID of the server (guild) | |
| eventId | Yes | The ID of the event | |
| name | No | New name | |
| description | No | New description | |
| scheduledStartTime | No | New start time (ISO 8601) | |
| scheduledEndTime | No | New end time (ISO 8601) | |
| status | No | New status | |
| location | No | New location | |
| reason | No | Reason for modifying |
Implementation Reference
- src/tools/event-tools.ts:178-215 (handler)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) }] }; }
- src/tools/event-tools.ts:167-177 (schema)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'), },
- src/tools/event-tools.ts:164-216 (registration)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';