Skip to main content
Glama
scarecr0w12

discord-mcp

list_servers

Retrieve all Discord servers where the bot is a member. Use this tool to view accessible guilds for management tasks.

Instructions

List all Discord servers (guilds) the bot has access to

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'list_servers' tool. It uses the Discord client to fetch all guilds (servers) the bot is in, extracts basic information (id, name, memberCount, ownerId, icon), handles errors with withErrorHandling, and returns the list as a formatted JSON string.
    async () => {
      const result = await withErrorHandling(async () => {
        const client = await getDiscordClient();
        const guilds = client.guilds.cache.map((guild) => ({
          id: guild.id,
          name: guild.name,
          memberCount: guild.memberCount,
          ownerId: guild.ownerId,
          icon: guild.iconURL(),
        }));
        return guilds;
      });
    
      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 for 'list_servers' tool: empty object, indicating no input parameters are required.
    {},
  • Direct registration of the 'list_servers' tool on the MCP server within the registerServerTools function, including name, description, schema, and handler.
    server.tool(
      'list_servers',
      'List all Discord servers (guilds) the bot has access to',
      {},
      async () => {
        const result = await withErrorHandling(async () => {
          const client = await getDiscordClient();
          const guilds = client.guilds.cache.map((guild) => ({
            id: guild.id,
            name: guild.name,
            memberCount: guild.memberCount,
            ownerId: guild.ownerId,
            icon: guild.iconURL(),
          }));
          return guilds;
        });
    
        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:54-54 (registration)
    Invocation of registerServerTools to register the server tools module (including 'list_servers') on the main MCP server instance.
    registerServerTools(server);
Behavior2/5

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

With no annotations provided, the description carries full burden but only states what the tool does, not how it behaves. It lacks details on output format (e.g., list structure, pagination), rate limits, authentication requirements, or error conditions. While 'List all' suggests a read operation, it doesn't explicitly confirm non-destructive behavior or data sensitivity.

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 with no wasted words. It front-loads the core action ('List all') and resource, includes necessary context ('Discord servers (guilds) the bot has access to'), and avoids redundancy. Every part of the sentence contributes directly to understanding the tool's function.

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 simplicity (0 parameters, no output schema, no annotations), the description is minimal but incomplete. It explains what the tool does but lacks behavioral context (e.g., output format, limitations) and usage guidance, which are needed for an agent to invoke it effectively in a real-world scenario with sibling tools like 'get_server_info'.

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 tool has 0 parameters, and schema description coverage is 100% (empty schema). The description doesn't need to explain parameters, so it meets the baseline of 4 for zero-parameter tools. It appropriately omits parameter details, focusing on the tool's purpose instead.

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

Purpose5/5

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

The description clearly states the specific action ('List all') and resource ('Discord servers (guilds)'), with the qualifier 'the bot has access to' distinguishing it from potentially listing all servers globally. It uses precise terminology ('guilds' as Discord's internal term) and avoids tautology with the tool name.

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. While it implies a read-only operation, it doesn't specify prerequisites (e.g., bot permissions), contrast with similar tools like 'get_server_info' (for single server details) or 'list_channels' (for server components), or indicate typical use cases (e.g., server 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/scarecr0w12/discord-mcp'

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