Skip to main content
Glama

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
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)

Implementation Reference

  • 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) }] }; }
  • Input schema for the 'list_emojis' tool, requiring the guildId parameter.
    { guildId: z.string().describe('The ID of the server (guild)'), },
  • 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);

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