Skip to main content
Glama

list_emojis

Retrieve all custom emojis from a Discord server by providing the guild ID to manage and organize server emoji collections.

Instructions

List all custom emojis in a server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)

Implementation Reference

  • The handler function that fetches all custom emojis from the specified Discord guild using the Discord client, maps them to a detailed JSON structure, and returns the result wrapped in MCP content format with error handling.
    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) }] }; }
  • Zod schema defining the input parameters for the list_emojis tool: guildId (string, required).
    { guildId: z.string().describe('The ID of the server (guild)'), },
  • Registers the list_emojis tool on the MCP server with its name, description, input schema, and handler function.
    server.tool( '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:60-60 (registration)
    Top-level registration call that invokes registerEmojiTools to add all emoji-related tools, including list_emojis, to the MCP server.
    registerEmojiTools(server);
  • src/index.ts:17-17 (registration)
    Import statement for the registerEmojiTools function that contains the list_emojis tool registration.
    import { registerEmojiTools } from './tools/emoji-tools.js';

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