Skip to main content
Glama
jar285

MCP-Discord

by jar285

discord_get_server_info

Retrieve Discord server details like channels and member count by providing the guild ID to analyze server structure and activity.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYes

Implementation Reference

  • The main handler logic for the discord_get_server_info tool. It validates input with GetServerInfoSchema, fetches the Discord guild using client.guilds.fetch, retrieves all channels, formats the server info (name, ID, member count, channels), and returns it as text content.
    case "discord_get_server_info": {
      // Use default server ID if not provided
      let parsedArgs = GetServerInfoSchema.parse(args);
      if (parsedArgs.guildId === 'default') {
        parsedArgs.guildId = process.env.DEFAULT_SERVER_ID || '';
      }
      
      const { guildId } = parsedArgs;
      
      try {
        if (!client.isReady()) {
          return {
            content: [{ type: "text", text: "Discord client not logged in. Please use discord_login tool first." }],
            isError: true
          };
        }
        
        const guild = await client.guilds.fetch(guildId);
        if (!guild) {
          return {
            content: [{ type: "text", text: `Cannot find guild with ID: ${guildId}` }],
            isError: true
          };
        }
        
        // Fetch channels
        const channels = await guild.channels.fetch();
        
        // Format channel info
        const channelInfo = channels.map(channel => {
          return {
            id: channel?.id,
            name: channel?.name,
            type: channel?.type
          };
        });
        
        return {
          content: [{ 
            type: "text", 
            text: `Server Information:\n` +
                  `Name: ${guild.name}\n` +
                  `ID: ${guild.id}\n` +
                  `Member Count: ${guild.memberCount}\n` +
                  `Channels: ${JSON.stringify(channelInfo, null, 2)}` 
          }]
        };
      } catch (error) {
        return {
          content: [{ type: "text", text: `Get server info failed: ${error}` }],
          isError: true
        };
      }
    }
  • Zod input schema definition used for validating the tool arguments: requires a guildId string.
    const GetServerInfoSchema = z.object({
        guildId: z.string()
    });
  • src/index.ts:321-330 (registration)
    Tool registration in the ListTools response array. Defines the tool's name, description, and JSON input schema matching the Zod schema.
      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"]
      }
    },
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 permissions required, rate limits, error handling, or response format. For a tool with zero annotation coverage, this leaves significant gaps in understanding how it behaves beyond basic functionality.

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 action ('Retrieves detailed information') and specifies key data included. There is no wasted language, and it directly communicates the tool's purpose without redundancy.

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

Completeness3/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 (1 parameter, no annotations, no output schema), the description is adequate but incomplete. It covers the basic purpose and data scope, but lacks details on behavioral aspects like permissions or output structure. For a read operation with minimal structured data, it meets minimum viability but leaves room for improvement.

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

Parameters4/5

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

The input schema has 1 parameter with 0% description coverage, so the description must compensate. It implies the need for a 'guildId' by mentioning 'Discord server', but doesn't explicitly define the parameter or its format. However, with only one parameter and clear context, the description adds sufficient meaning beyond the bare schema, though not detailed syntax.

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 resource ('detailed information about a Discord server'), specifying what data is included ('channels and member count'). It distinguishes from siblings like 'discord_list_guilds' by focusing on a single server's details rather than listing all guilds. However, it doesn't explicitly contrast with other read operations like 'discord_get_forum_post', keeping it from 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 prerequisites (e.g., needing a guildId), exclusions, or compare it to siblings like 'discord_list_guilds' for overviews or 'discord_get_forum_channels' for specific channel types. Usage is implied only by the tool's name and description, lacking explicit context.

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

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