Skip to main content
Glama
scarecr0w12

discord-mcp

get_channel_permissions

Retrieve all permission overwrites for a Discord channel to manage access controls and role-based permissions within a server.

Instructions

Get all permission overwrites for a channel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)
channelIdYesThe ID of the channel

Implementation Reference

  • The handler function that implements the core logic of fetching channel permission overwrites, resolving names for roles/members, and returning formatted JSON.
    async ({ guildId, channelId }) => {
      const result = await withErrorHandling(async () => {
        const client = await getDiscordClient();
        const guild = await client.guilds.fetch(guildId);
        const channel = await guild.channels.fetch(channelId);
        if (!channel) throw new Error('Channel not found');
    
        const overwrites = (channel as GuildChannel).permissionOverwrites.cache.map((overwrite) => ({
          id: overwrite.id,
          type: overwrite.type === OverwriteType.Role ? 'role' : 'member',
          allow: overwrite.allow.toArray(),
          deny: overwrite.deny.toArray(),
        }));
    
        // Get role/member names for context
        const resolvedOverwrites = await Promise.all(
          overwrites.map(async (ow) => {
            let name = 'Unknown';
            if (ow.type === 'role') {
              const role = await guild.roles.fetch(ow.id);
              name = role?.name ?? 'Unknown Role';
            } else {
              try {
                const member = await guild.members.fetch(ow.id);
                name = member.displayName;
              } catch {
                name = 'Unknown Member';
              }
            }
            return { ...ow, name };
          })
        );
    
        return {
          channelId,
          channelName: channel.name,
          overwrites: resolvedOverwrites,
        };
      });
    
      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 using Zod for validating guildId and channelId parameters.
    {
      guildId: z.string().describe('The ID of the server (guild)'),
      channelId: z.string().describe('The ID of the channel'),
    },
  • Registration of the 'get_channel_permissions' tool on the MCP server, including name, description, schema, and handler.
    server.tool(
      'get_channel_permissions',
      'Get all permission overwrites for a channel',
      {
        guildId: z.string().describe('The ID of the server (guild)'),
        channelId: z.string().describe('The ID of the channel'),
      },
      async ({ guildId, channelId }) => {
        const result = await withErrorHandling(async () => {
          const client = await getDiscordClient();
          const guild = await client.guilds.fetch(guildId);
          const channel = await guild.channels.fetch(channelId);
          if (!channel) throw new Error('Channel not found');
    
          const overwrites = (channel as GuildChannel).permissionOverwrites.cache.map((overwrite) => ({
            id: overwrite.id,
            type: overwrite.type === OverwriteType.Role ? 'role' : 'member',
            allow: overwrite.allow.toArray(),
            deny: overwrite.deny.toArray(),
          }));
    
          // Get role/member names for context
          const resolvedOverwrites = await Promise.all(
            overwrites.map(async (ow) => {
              let name = 'Unknown';
              if (ow.type === 'role') {
                const role = await guild.roles.fetch(ow.id);
                name = role?.name ?? 'Unknown Role';
              } else {
                try {
                  const member = await guild.members.fetch(ow.id);
                  name = member.displayName;
                } catch {
                  name = 'Unknown Member';
                }
              }
              return { ...ow, name };
            })
          );
    
          return {
            channelId,
            channelName: channel.name,
            overwrites: resolvedOverwrites,
          };
        });
    
        if (!result.success) {
          return { content: [{ type: 'text', text: result.error }], isError: true };
        }
    
        return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] };
      }
    );
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. While 'Get' implies a read operation, it doesn't disclose important behavioral aspects like whether this requires specific permissions (e.g., 'MANAGE_CHANNELS'), rate limits, pagination behavior, or what format the permission data returns. The description is minimal and lacks operational context.

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 communicates the core purpose without unnecessary words. It's appropriately sized for a straightforward read operation and gets directly to the point with zero wasted text.

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?

For a tool with no annotations and no output schema, the description is insufficient. It doesn't explain what 'permission overwrites' means in practical terms, what data structure returns, or any operational constraints. Given the complexity of Discord permissions and the lack of structured output documentation, this leaves significant gaps for an AI agent.

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 channelId) clearly documented in the schema. The description doesn't add any additional semantic context about these parameters beyond what's already in the schema, so the baseline score of 3 is appropriate.

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 action ('Get') and target resource ('all permission overwrites for a channel'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'list_permissions' or 'get_channel_info', which might have overlapping functionality in a Discord API context.

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. With sibling tools like 'list_permissions' and 'get_channel_info' available, there's no indication of when this specific permission-focused tool is preferred or what distinguishes it from broader listing tools.

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