list_emojis
Retrieve all custom emojis from a Discord server by providing the guild ID to manage and view available emoji collections.
Instructions
List all custom emojis in a server
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| guildId | Yes | The ID of the server (guild) |
Implementation Reference
- src/tools/emoji-tools.ts:14-39 (handler)The handler function for the 'list_emojis' tool. Fetches all custom emojis from the specified Discord guild, maps them to a structured format, and returns the JSON stringified list or an error message.async ({ guildId }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const guild = await client.guilds.fetch(guildId); const emojis = await guild.emojis.fetch(); return emojis.map((emoji) => ({ id: emoji.id, name: emoji.name, animated: emoji.animated, available: emoji.available, managed: emoji.managed, requiresColons: emoji.requiresColons, roles: emoji.roles.cache.map((r) => ({ id: r.id, name: r.name })), author: emoji.author ? { id: emoji.author.id, username: emoji.author.username } : null, identifier: emoji.identifier, url: emoji.url, })); }); 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:11-13 (schema)Input schema for the 'list_emojis' tool, requiring the guildId parameter.{ guildId: z.string().describe('The ID of the server (guild)'), },
- src/tools/emoji-tools.ts:9-40 (registration)Registers the 'list_emojis' tool with the MCP server, including name, description, input schema, and handler function.'list_emojis', 'List all custom emojis in a server', { guildId: z.string().describe('The ID of the server (guild)'), }, async ({ guildId }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const guild = await client.guilds.fetch(guildId); const emojis = await guild.emojis.fetch(); return emojis.map((emoji) => ({ id: emoji.id, name: emoji.name, animated: emoji.animated, available: emoji.available, managed: emoji.managed, requiresColons: emoji.requiresColons, roles: emoji.roles.cache.map((r) => ({ id: r.id, name: r.name })), author: emoji.author ? { id: emoji.author.id, username: emoji.author.username } : null, identifier: emoji.identifier, url: emoji.url, })); }); 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 the registerEmojiTools function to register all emoji tools, including 'list_emojis', with the MCP server.registerEmojiTools(server);