Skip to main content
Glama

discord_get_server_info

Retrieve detailed Discord server information including channels and member count by providing the guild ID.

Instructions

Retrieves detailed information about a Discord server including channels and member count

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYes

Implementation Reference

  • The primary handler function for 'discord_get_server_info' tool. Fetches Discord guild/server details including member count, channel categorization by type, detailed channel list, features, and premium info. Returns formatted JSON response.
    export async function getServerInfoHandler(
      args: unknown,
      context: ToolContext
    ): Promise<ToolResponse> {
      const { guildId } = GetServerInfoSchema.parse(args);
      try {
        if (!context.client.isReady()) {
          return {
            content: [{ type: 'text', text: 'Discord client not logged in.' }],
            isError: true,
          };
        }
    
        const guild = await context.client.guilds.fetch(guildId);
        if (!guild) {
          return {
            content: [
              { type: 'text', text: `Cannot find guild with ID: ${guildId}` },
            ],
            isError: true,
          };
        }
    
        // Fetch additional server data
        await guild.fetch();
    
        // Fetch channel information
        const channels = await guild.channels.fetch();
    
        // Categorize channels by type
        const channelsByType = {
          text: channels.filter((c) => c?.type === ChannelType.GuildText).size,
          voice: channels.filter((c) => c?.type === ChannelType.GuildVoice).size,
          category: channels.filter((c) => c?.type === ChannelType.GuildCategory)
            .size,
          forum: channels.filter((c) => c?.type === ChannelType.GuildForum).size,
          announcement: channels.filter(
            (c) => c?.type === ChannelType.GuildAnnouncement
          ).size,
          stage: channels.filter((c) => c?.type === ChannelType.GuildStageVoice)
            .size,
          total: channels.size,
        };
    
        // Get detailed information for all channels
        const channelDetails = channels
          .map((channel) => {
            if (!channel) {
              return null;
            }
    
            return {
              id: channel.id,
              name: channel.name,
              type: ChannelType[channel.type] || channel.type,
              categoryId: channel.parentId,
              position: channel.position,
              // Only add topic for text channels
              topic: 'topic' in channel ? channel.topic : null,
            };
          })
          .filter((c) => c !== null); // Filter out null values
    
        // Group channels by type
        const groupedChannels = {
          text: channelDetails.filter(
            (c) =>
              c.type === ChannelType[ChannelType.GuildText] ||
              c.type === ChannelType.GuildText
          ),
          voice: channelDetails.filter(
            (c) =>
              c.type === ChannelType[ChannelType.GuildVoice] ||
              c.type === ChannelType.GuildVoice
          ),
          category: channelDetails.filter(
            (c) =>
              c.type === ChannelType[ChannelType.GuildCategory] ||
              c.type === ChannelType.GuildCategory
          ),
          forum: channelDetails.filter(
            (c) =>
              c.type === ChannelType[ChannelType.GuildForum] ||
              c.type === ChannelType.GuildForum
          ),
          announcement: channelDetails.filter(
            (c) =>
              c.type === ChannelType[ChannelType.GuildAnnouncement] ||
              c.type === ChannelType.GuildAnnouncement
          ),
          stage: channelDetails.filter(
            (c) =>
              c.type === ChannelType[ChannelType.GuildStageVoice] ||
              c.type === ChannelType.GuildStageVoice
          ),
          all: channelDetails,
        };
    
        // Get member count
        const approximateMemberCount = guild.approximateMemberCount || 'unknown';
    
        // Format guild information
        const guildInfo = {
          id: guild.id,
          name: guild.name,
          description: guild.description,
          icon: guild.iconURL(),
          owner: guild.ownerId,
          createdAt: guild.createdAt,
          memberCount: approximateMemberCount,
          channels: {
            count: channelsByType,
            details: groupedChannels,
          },
          features: guild.features,
          premium: {
            tier: guild.premiumTier,
            subscriptions: guild.premiumSubscriptionCount,
          },
        };
    
        return {
          content: [{ type: 'text', text: JSON.stringify(guildInfo, null, 2) }],
        };
      } catch (error) {
        return handleDiscordError(error);
      }
    }
  • MCP tool schema definition including name, description, and input schema requiring 'guildId'.
    {
      name: 'discord_get_server_info',
      description:
        'Retrieves detailed information about a Discord server including channels and member count',
      inputSchema: {
        type: 'object',
        properties: {
          guildId: { type: 'string' },
        },
        required: ['guildId'],
      },
    },
  • src/server.ts:156-159 (registration)
    Tool registration in the MCP server request handler switch statement, dispatching to getServerInfoHandler.
    case 'discord_get_server_info':
      this.logClientState('before discord_get_server_info handler');
      toolResponse = await getServerInfoHandler(args, this.toolContext);
      return toolResponse;
  • Zod schema for input validation used in the handler (GetServerInfoSchema).
    export const GetServerInfoSchema = z.object({
      guildId: z.string(),
    });
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states it 'retrieves' information, implying a read-only operation, but doesn't specify if it requires authentication, rate limits, error conditions, or what 'detailed information' entails beyond channels and member count. This is a significant gap 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 front-loads the core purpose ('Retrieves detailed information about a Discord server') and adds specific details ('including channels and member count'). There's no wasted verbiage, making it highly concise and well-structured.

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 the tool's moderate complexity (retrieving server details), no annotations, no output schema, and 0% schema description coverage, the description is incomplete. It lacks information on authentication needs, return format, error handling, and parameter semantics, leaving the agent with insufficient context for reliable use.

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?

The input schema has 1 parameter (guildId) with 0% description coverage, meaning the schema provides no semantic context. The description doesn't mention guildId or explain what it represents (e.g., a server ID). However, since there's only one parameter and its purpose is inferable from the tool name, the baseline is 3, but it adds no value beyond the schema.

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 'retrieves' and the resource 'detailed information about a Discord server', specifying it includes 'channels and member count'. This distinguishes it from siblings like discord_get_forum_channels (more specific) or discord_read_messages (different resource). However, it doesn't explicitly differentiate from all siblings (e.g., discord_get_forum_post is similar but for posts), keeping it from a perfect 5.

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 prerequisites (e.g., needing guildId), exclusions, or comparisons to siblings like discord_get_forum_channels (for forum-specific data) or discord_read_messages (for message retrieval). This leaves the agent without context for tool selection.

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

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