Skip to main content
Glama

create_emoji

Add custom emojis to Discord servers by uploading images and configuring usage permissions for enhanced community expression.

Instructions

Create a custom emoji in a server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)
nameYesName for the emoji
imageUrlYesURL of the image to use (must be < 256KB)
rolesNoRole IDs that can use this emoji
reasonNoReason for creating the emoji

Implementation Reference

  • The handler function that executes the create_emoji tool: fetches the Discord guild and creates the emoji using guild.emojis.create(), handles errors with withErrorHandling, and returns JSON response.
    async ({ guildId, name, imageUrl, roles, reason }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const guild = await client.guilds.fetch(guildId); const emoji = await guild.emojis.create({ attachment: imageUrl, name, roles, reason, }); return { id: emoji.id, name: emoji.name, animated: emoji.animated, identifier: emoji.identifier, url: emoji.url, message: 'Emoji created 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 for create_emoji tool using Zod validation for parameters: guildId, name, imageUrl, optional roles and reason.
    { guildId: z.string().describe('The ID of the server (guild)'), name: z.string().describe('Name for the emoji'), imageUrl: z.string().describe('URL of the image to use (must be < 256KB)'), roles: z.array(z.string()).optional().describe('Role IDs that can use this emoji'), reason: z.string().optional().describe('Reason for creating the emoji'), },
  • Registration of the create_emoji tool on the MCP server using server.tool(), including name, description, schema, and handler.
    'create_emoji', 'Create a custom emoji in a server', { guildId: z.string().describe('The ID of the server (guild)'), name: z.string().describe('Name for the emoji'), imageUrl: z.string().describe('URL of the image to use (must be < 256KB)'), roles: z.array(z.string()).optional().describe('Role IDs that can use this emoji'), reason: z.string().optional().describe('Reason for creating the emoji'), }, async ({ guildId, name, imageUrl, roles, reason }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const guild = await client.guilds.fetch(guildId); const emoji = await guild.emojis.create({ attachment: imageUrl, name, roles, reason, }); return { id: emoji.id, name: emoji.name, animated: emoji.animated, identifier: emoji.identifier, url: emoji.url, message: 'Emoji created 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)
    Call to registerEmojiTools(server) which registers all emoji tools including create_emoji.
    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