Skip to main content
Glama
scarecr0w12

discord-mcp

list_invites

Retrieve all active invitation links for a Discord server to manage access and monitor invite usage.

Instructions

List all invites in a server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)

Implementation Reference

  • Handler function that executes the list_invites tool: fetches all invites for the given guild using Discord.js, maps them to a structured format, handles errors with withErrorHandling, and returns JSON string.
    async ({ guildId }) => {
      const result = await withErrorHandling(async () => {
        const client = await getDiscordClient();
        const guild = await client.guilds.fetch(guildId);
        const invites = await guild.invites.fetch();
    
        return invites.map((invite) => ({
          code: invite.code,
          url: invite.url,
          channelId: invite.channelId,
          channelName: invite.channel?.name,
          inviterId: invite.inviterId,
          inviterUsername: invite.inviter?.username,
          uses: invite.uses,
          maxUses: invite.maxUses,
          maxAge: invite.maxAge,
          temporary: invite.temporary,
          createdAt: invite.createdAt?.toISOString(),
          expiresAt: invite.expiresAt?.toISOString(),
          targetType: invite.targetType,
          targetUserId: invite.targetUser?.id,
        }));
      });
    
      if (!result.success) {
        return { content: [{ type: 'text', text: result.error }], isError: true };
      }
    
      return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] };
    }
  • Zod input schema defining the guildId parameter required for the list_invites tool.
    {
      guildId: z.string().describe('The ID of the server (guild)'),
    },
  • Direct registration of the list_invites tool on the MCP server within the registerInviteTools function.
    server.tool(
      'list_invites',
      'List all invites in a server',
      {
        guildId: z.string().describe('The ID of the server (guild)'),
      },
      async ({ guildId }) => {
        const result = await withErrorHandling(async () => {
          const client = await getDiscordClient();
          const guild = await client.guilds.fetch(guildId);
          const invites = await guild.invites.fetch();
    
          return invites.map((invite) => ({
            code: invite.code,
            url: invite.url,
            channelId: invite.channelId,
            channelName: invite.channel?.name,
            inviterId: invite.inviterId,
            inviterUsername: invite.inviter?.username,
            uses: invite.uses,
            maxUses: invite.maxUses,
            maxAge: invite.maxAge,
            temporary: invite.temporary,
            createdAt: invite.createdAt?.toISOString(),
            expiresAt: invite.expiresAt?.toISOString(),
            targetType: invite.targetType,
            targetUserId: invite.targetUser?.id,
          }));
        });
    
        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:62-62 (registration)
    Invocation of registerInviteTools in the main MCP server creation, which registers the list_invites tool among others.
    registerInviteTools(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 for behavioral disclosure. It states it's a list operation, implying read-only behavior, but doesn't specify whether it returns all invites at once, uses pagination, requires specific permissions, has rate limits, or what the output format looks like. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

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, clear sentence with zero wasted words. It's appropriately sized for a simple list operation and front-loads the essential information (verb + resource). Every word earns its place without being overly brief or verbose.

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, no output schema, and a simple single-parameter input schema, the description is incomplete. It doesn't address what the tool returns (list format, fields included), any behavioral constraints, or how it differs from related tools. For a tool in a Discord API context where invites can have complex properties, more context would be helpful.

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 100% description coverage (guildId is fully documented), so the baseline is 3. The description doesn't add any parameter-specific information beyond what's in the schema - it mentions 'server' which aligns with 'guildId' but provides no additional context about parameter usage, constraints, or examples.

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 ('List') and resource ('invites in a server'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'get_invite_info' (which likely retrieves details about a specific invite) or 'create_invite' (which creates new invites), missing an opportunity for clearer sibling distinction.

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 when this tool is appropriate (e.g., for bulk listing vs. getting specific invite details with 'get_invite_info') or any prerequisites beyond the required guildId parameter. No explicit when/when-not statements or alternative tool references are included.

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