delete_emoji
Remove custom emojis from Discord servers using server and emoji IDs to manage server content and organization.
Instructions
Delete a custom emoji from a server
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| guildId | Yes | The ID of the server (guild) | |
| emojiId | Yes | The ID of the emoji to delete | |
| reason | No | Reason for deleting the emoji |
Implementation Reference
- src/tools/emoji-tools.ts:92-108 (handler)The main handler function that performs the emoji deletion logic: fetches guild and emoji, deletes it with optional reason, wraps in error handling, and returns formatted response.async ({ guildId, emojiId, 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 emojiName = emoji.name; await emoji.delete(reason); return { emojiId, emojiName, message: 'Emoji deleted 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/emoji-tools.ts:87-90 (schema)Zod input schema for the delete_emoji tool defining required guildId and emojiId, optional reason.{ guildId: z.string().describe('The ID of the server (guild)'), emojiId: z.string().describe('The ID of the emoji to delete'), reason: z.string().optional().describe('Reason for deleting the emoji'),
- src/tools/emoji-tools.ts:84-109 (registration)Registers the delete_emoji tool on the MCP server including name, description, schema, and handler.server.tool( 'delete_emoji', 'Delete a custom emoji from a server', { guildId: z.string().describe('The ID of the server (guild)'), emojiId: z.string().describe('The ID of the emoji to delete'), reason: z.string().optional().describe('Reason for deleting the emoji'), }, async ({ guildId, emojiId, 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 emojiName = emoji.name; await emoji.delete(reason); return { emojiId, emojiName, message: 'Emoji deleted 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:59-59 (registration)Calls registerEmojiTools(server) which registers the delete_emoji tool among others.registerEmojiTools(server);
- src/index.ts:17-17 (registration)Imports the registerEmojiTools function used to register emoji tools including delete_emoji.import { registerEmojiTools } from './tools/emoji-tools.js';