Skip to main content
Glama
scarecr0w12

discord-mcp

get_role_info

Retrieve detailed information about a Discord server role using guild and role IDs to manage permissions and settings.

Instructions

Get detailed information about a specific role

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)
roleIdYesThe ID of the role

Implementation Reference

  • The handler function that implements the core logic of get_role_info: fetches the Discord guild and role, extracts detailed properties including permissions, creation date, icon, members list, and returns formatted JSON response or error.
    async ({ guildId, roleId }) => {
      const result = await withErrorHandling(async () => {
        const client = await getDiscordClient();
        const guild = await client.guilds.fetch(guildId);
        const role = await guild.roles.fetch(roleId);
        if (!role) throw new Error('Role not found');
    
        return {
          id: role.id,
          name: role.name,
          color: role.hexColor,
          position: role.position,
          hoist: role.hoist,
          mentionable: role.mentionable,
          managed: role.managed,
          permissions: role.permissions.toArray(),
          createdAt: role.createdAt.toISOString(),
          icon: role.iconURL(),
          unicodeEmoji: role.unicodeEmoji,
          members: role.members.map((m) => ({ id: m.id, username: m.user.username })),
          editable: role.editable,
        };
      });
    
      if (!result.success) {
        return { content: [{ type: 'text', text: result.error }], isError: true };
      }
    
      return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] };
    }
  • Zod schema validating the input parameters for the tool: guildId (string) and roleId (string).
    {
      guildId: z.string().describe('The ID of the server (guild)'),
      roleId: z.string().describe('The ID of the role'),
    },
  • The server.tool() call that registers the get_role_info tool on the MCP server, providing name, description, input schema, and handler function.
    'get_role_info',
    'Get detailed information about a specific role',
    {
      guildId: z.string().describe('The ID of the server (guild)'),
      roleId: z.string().describe('The ID of the role'),
    },
    async ({ guildId, roleId }) => {
      const result = await withErrorHandling(async () => {
        const client = await getDiscordClient();
        const guild = await client.guilds.fetch(guildId);
        const role = await guild.roles.fetch(roleId);
        if (!role) throw new Error('Role not found');
    
        return {
          id: role.id,
          name: role.name,
          color: role.hexColor,
          position: role.position,
          hoist: role.hoist,
          mentionable: role.mentionable,
          managed: role.managed,
          permissions: role.permissions.toArray(),
          createdAt: role.createdAt.toISOString(),
          icon: role.iconURL(),
          unicodeEmoji: role.unicodeEmoji,
          members: role.members.map((m) => ({ id: m.id, username: m.user.username })),
          editable: role.editable,
        };
      });
    
      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:57-57 (registration)
    Invocation of registerRoleTools(server) in the main MCP server setup, which registers all role tools including get_role_info.
    registerRoleTools(server);
  • src/index.ts:14-14 (registration)
    Import of the registerRoleTools function used to register role management tools.
    import { registerRoleTools } from './tools/role-tools.js';
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states this is a 'Get' operation, implying read-only behavior, but doesn't disclose any behavioral traits such as authentication requirements, rate limits, error conditions, or what 'detailed information' includes. This leaves significant gaps for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose with zero wasted words. It's appropriately sized and front-loaded, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete for a tool that presumably returns role details. It doesn't explain what 'detailed information' includes (e.g., permissions, color, members), nor does it cover behavioral aspects like error handling. For a read operation with structured return data expected, this leaves too many gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with both parameters (guildId and roleId) clearly documented in the schema. The description adds no additional meaning about parameters beyond implying they identify a specific role, so it meets the baseline score of 3 where the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Get' and the resource 'detailed information about a specific role', making the purpose unambiguous. However, it doesn't differentiate from sibling tools like 'list_roles' or 'get_member_info' which might also provide role-related information, preventing a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'list_roles' (for listing all roles) or 'get_member_info' (which might include role data), nor does it specify prerequisites or appropriate contexts for use.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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