create_sticker
Create custom stickers for Discord servers by providing an image URL, name, description, and tags to enhance server customization and communication.
Instructions
Create a custom sticker in a server
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| guildId | Yes | The ID of the server (guild) | |
| name | Yes | Name for the sticker (2-30 characters) | |
| description | Yes | Description of the sticker | |
| tags | Yes | Autocomplete/suggestion tags for the sticker | |
| imageUrl | Yes | URL of the image (PNG, APNG, GIF, or Lottie JSON) | |
| reason | No | Reason for creating the sticker |
Implementation Reference
- src/tools/emoji-tools.ts:198-226 (handler)The handler function that performs the core logic of creating a custom sticker in a Discord server using the guild.stickers.create method, wrapped in error handling, and returns a formatted JSON response.async ({ guildId, name, description, tags, imageUrl, reason }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const guild = await client.guilds.fetch(guildId); const sticker = await guild.stickers.create({ file: imageUrl, name, description, tags, reason, }); return { id: sticker.id, name: sticker.name, description: sticker.description, tags: sticker.tags, url: sticker.url, message: 'Sticker 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/tools/emoji-tools.ts:190-197 (schema)Zod schema validating the input parameters for the create_sticker tool.{ guildId: z.string().describe('The ID of the server (guild)'), name: z.string().describe('Name for the sticker (2-30 characters)'), description: z.string().describe('Description of the sticker'), tags: z.string().describe('Autocomplete/suggestion tags for the sticker'), imageUrl: z.string().describe('URL of the image (PNG, APNG, GIF, or Lottie JSON)'), reason: z.string().optional().describe('Reason for creating the sticker'), },
- src/tools/emoji-tools.ts:188-227 (registration)Registers the create_sticker tool on the MCP server using server.tool(), including name, description, input schema, and handler function.'create_sticker', 'Create a custom sticker in a server', { guildId: z.string().describe('The ID of the server (guild)'), name: z.string().describe('Name for the sticker (2-30 characters)'), description: z.string().describe('Description of the sticker'), tags: z.string().describe('Autocomplete/suggestion tags for the sticker'), imageUrl: z.string().describe('URL of the image (PNG, APNG, GIF, or Lottie JSON)'), reason: z.string().optional().describe('Reason for creating the sticker'), }, async ({ guildId, name, description, tags, imageUrl, reason }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const guild = await client.guilds.fetch(guildId); const sticker = await guild.stickers.create({ file: imageUrl, name, description, tags, reason, }); return { id: sticker.id, name: sticker.name, description: sticker.description, tags: sticker.tags, url: sticker.url, message: 'Sticker 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)Invokes registerEmojiTools to register the emoji and sticker tools, including create_sticker, on the main MCP server instance.registerEmojiTools(server);