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
| 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)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) }] }; }
- src/tools/event-tools.ts:167-177 (schema)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'), },
- src/tools/event-tools.ts:164-216 (registration)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);