Skip to main content
Glama

create_emoji

Add custom emojis to Discord servers by uploading images, naming them, and setting 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 implements the core logic of the create_emoji tool. It fetches the Discord guild, creates the emoji using the provided image URL and parameters, handles errors, and formats the 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) }] }; }
  • Zod input schema defining parameters for the create_emoji tool: guildId (required), name (required), imageUrl (required), roles (optional array), reason (optional).
    { 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'), },
  • Registers the create_emoji tool on the MCP server within the registerEmojiTools function, specifying name, description, input 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:59-59 (registration)
    Top-level call to registerEmojiTools(server) in createMcpServer function, which in turn registers the create_emoji tool among others.
    registerEmojiTools(server);
  • src/index.ts:17-17 (registration)
    Import of registerEmojiTools from emoji-tools.ts in the main index.ts file.
    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