modify_server
Update Discord server settings including name, description, channels, and AFK timeout using the guild ID. Requires appropriate permissions to manage server configuration.
Instructions
Modify server settings (requires appropriate permissions)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| guildId | Yes | The ID of the server (guild) | |
| name | No | New server name | |
| description | No | New server description | |
| afkChannelId | No | ID of the AFK channel | |
| afkTimeout | No | AFK timeout in seconds | |
| systemChannelId | No | ID of the system channel | |
| rulesChannelId | No | ID of the rules channel | |
| reason | No | Reason for the modification |
Implementation Reference
- src/tools/server-tools.ts:106-155 (registration)Registration of the 'modify_server' tool including schema definition and complete handler implementation. The handler fetches the guild, prepares update data based on provided parameters, edits the guild, and returns the updated information or error.server.tool( 'modify_server', 'Modify server settings (requires appropriate permissions)', { guildId: z.string().describe('The ID of the server (guild)'), name: z.string().optional().describe('New server name'), description: z.string().optional().describe('New server description'), afkChannelId: z.string().optional().describe('ID of the AFK channel'), afkTimeout: z.number().optional().describe('AFK timeout in seconds'), systemChannelId: z.string().optional().describe('ID of the system channel'), rulesChannelId: z.string().optional().describe('ID of the rules channel'), reason: z.string().optional().describe('Reason for the modification'), }, async ({ guildId, name, description, afkChannelId, afkTimeout, systemChannelId, rulesChannelId, reason }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const guild = await client.guilds.fetch(guildId); const updateData: Record<string, unknown> = {}; if (name !== undefined) updateData.name = name; if (description !== undefined) updateData.description = description; if (afkChannelId !== undefined) updateData.afkChannel = afkChannelId; if (afkTimeout !== undefined) updateData.afkTimeout = afkTimeout; if (systemChannelId !== undefined) updateData.systemChannel = systemChannelId; if (rulesChannelId !== undefined) updateData.rulesChannel = rulesChannelId; if (reason !== undefined) updateData.reason = reason; const updatedGuild = await guild.edit(updateData); return { id: updatedGuild.id, name: updatedGuild.name, description: updatedGuild.description, message: 'Server settings 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/server-tools.ts:119-154 (handler)The core handler logic for the modify_server tool. It conditionally builds an update object from input parameters, calls guild.edit() on the Discord guild, handles errors with withErrorHandling, and formats the response as MCP content.async ({ guildId, name, description, afkChannelId, afkTimeout, systemChannelId, rulesChannelId, reason }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const guild = await client.guilds.fetch(guildId); const updateData: Record<string, unknown> = {}; if (name !== undefined) updateData.name = name; if (description !== undefined) updateData.description = description; if (afkChannelId !== undefined) updateData.afkChannel = afkChannelId; if (afkTimeout !== undefined) updateData.afkTimeout = afkTimeout; if (systemChannelId !== undefined) updateData.systemChannel = systemChannelId; if (rulesChannelId !== undefined) updateData.rulesChannel = rulesChannelId; if (reason !== undefined) updateData.reason = reason; const updatedGuild = await guild.edit(updateData); return { id: updatedGuild.id, name: updatedGuild.name, description: updatedGuild.description, message: 'Server settings 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/server-tools.ts:109-118 (schema)Zod schema defining the input parameters for the modify_server tool, including required guildId and optional fields for server settings.{ guildId: z.string().describe('The ID of the server (guild)'), name: z.string().optional().describe('New server name'), description: z.string().optional().describe('New server description'), afkChannelId: z.string().optional().describe('ID of the AFK channel'), afkTimeout: z.number().optional().describe('AFK timeout in seconds'), systemChannelId: z.string().optional().describe('ID of the system channel'), rulesChannelId: z.string().optional().describe('ID of the rules channel'), reason: z.string().optional().describe('Reason for the modification'), },