Skip to main content
Glama

list_invites

Retrieve all active Discord server invites by providing the guild ID to manage and monitor invitation links.

Instructions

List all invites in a server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)

Implementation Reference

  • Core handler implementation for the 'list_invites' tool. Registers the tool with MCP server, defines input schema (guildId), fetches all invites from the specified Discord guild, maps them to a structured format, handles errors with withErrorHandling, and returns JSON stringified response.
    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) }] }; } );
  • Input schema for list_invites tool using Zod: requires guildId as string.
    { guildId: z.string().describe('The ID of the server (guild)'), },
  • src/index.ts:61-61 (registration)
    Registration of invite tools (including list_invites) by calling registerInviteTools(server) in the MCP server setup.
    registerInviteTools(server);
  • src/index.ts:19-19 (registration)
    Import of registerInviteTools function that contains the list_invites tool registration.
    import { registerInviteTools } from './tools/invite-tools.js';

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