Skip to main content
Glama

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
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)
nameNoNew server name
descriptionNoNew server description
afkChannelIdNoID of the AFK channel
afkTimeoutNoAFK timeout in seconds
systemChannelIdNoID of the system channel
rulesChannelIdNoID of the rules channel
reasonNoReason for the modification

Implementation Reference

  • 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), }, ], }; } );
  • 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), }, ], }; }
  • 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'), },

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