Skip to main content
Glama

discord_create_role

Create a new role in a Discord server with custom name, color, permissions, and display settings to organize members and manage access.

Instructions

Create a new role in a guild.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guild_idYes
nameYes
colorNoHex color e.g. #FF5733
hoistNo
mentionableNo
permissionsNoe.g. ['SendMessages','ViewChannel']

Implementation Reference

  • The handler logic for "discord_create_role" which interacts with the discord.js library to create a role in a guild.
    case "discord_create_role": {
      const guild = await discord.guilds.fetch(validateId(args.guild_id, "guild_id"));
      const perms = parsePerms(args.permissions);
      const role = await guild.roles.create({
        name: args.name as string,
        color: args.color as ColorResolvable | undefined,
        hoist: args.hoist as boolean | undefined,
        mentionable: args.mentionable as boolean | undefined,
        permissions: perms
          ? new PermissionsBitField(perms.map((p) => PermissionsBitField.Flags[p as keyof typeof PermissionsBitField.Flags]))
          : undefined,
      });
      return { content: [{ type: "text", text: `✅ Role "${role.name}" created (id: ${role.id}).` }] };
    }
  • The MCP tool definition (schema) for "discord_create_role".
    {
      name: "discord_create_role",
      description: "Create a new role in a guild.",
      inputSchema: {
        type: "object",
        properties: {
          guild_id: { type: "string" },
          name: { type: "string" },
          color: { type: "string", description: "Hex color e.g. #FF5733" },
          hoist: { type: "boolean" },
          mentionable: { type: "boolean" },
          permissions: { type: "array", items: { type: "string" }, description: "e.g. ['SendMessages','ViewChannel']" },
        },
        required: ["guild_id", "name"],
      },
    },

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/PaSympa/discord-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server