Skip to main content
Glama

modify_emoji

Change custom emoji names and permissions in Discord servers to manage accessibility and organization.

Instructions

Modify a custom emoji in a server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)
emojiIdYesThe ID of the emoji to modify
nameNoNew name for the emoji
rolesNoRole IDs that can use this emoji
reasonNoReason for modifying the emoji

Implementation Reference

  • Full tool registration for 'modify_emoji' including name, description, input schema with Zod validation, and the handler function that modifies the emoji using Discord.js API.
    server.tool( 'modify_emoji', 'Modify a custom emoji in a server', { guildId: z.string().describe('The ID of the server (guild)'), emojiId: z.string().describe('The ID of the emoji to modify'), name: z.string().optional().describe('New name for the emoji'), roles: z.array(z.string()).optional().describe('Role IDs that can use this emoji'), reason: z.string().optional().describe('Reason for modifying the emoji'), }, async ({ guildId, emojiId, name, roles, reason }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const guild = await client.guilds.fetch(guildId); const emoji = await guild.emojis.fetch(emojiId); const editData: { name?: string; roles?: string[]; reason?: string } = {}; if (name) editData.name = name; if (roles) editData.roles = roles; if (reason) editData.reason = reason; const updated = await emoji.edit(editData); return { id: updated.id, name: updated.name, roles: updated.roles.cache.map((r) => ({ id: r.id, name: r.name })), message: 'Emoji 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:60-60 (registration)
    Top-level registration call that invokes registerEmojiTools(server), which registers the modify_emoji tool among others.
    registerEmojiTools(server);
  • The core handler function for the modify_emoji tool. It fetches the guild and emoji, constructs edit data from parameters, calls emoji.edit(), handles errors with withErrorHandling, and returns formatted response.
    async ({ guildId, emojiId, name, roles, reason }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const guild = await client.guilds.fetch(guildId); const emoji = await guild.emojis.fetch(emojiId); const editData: { name?: string; roles?: string[]; reason?: string } = {}; if (name) editData.name = name; if (roles) editData.roles = roles; if (reason) editData.reason = reason; const updated = await emoji.edit(editData); return { id: updated.id, name: updated.name, roles: updated.roles.cache.map((r) => ({ id: r.id, name: r.name })), message: 'Emoji 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) }] }; }
  • Input schema using Zod for validating parameters: guildId (required), emojiId (required), optional name, roles array, reason.
    { guildId: z.string().describe('The ID of the server (guild)'), emojiId: z.string().describe('The ID of the emoji to modify'), name: z.string().optional().describe('New name for the emoji'), roles: z.array(z.string()).optional().describe('Role IDs that can use this emoji'), reason: z.string().optional().describe('Reason for modifying the emoji'), },

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