Skip to main content
Glama

get_invite_info

Retrieve detailed information about a Discord invite using its code, including server details and usage statistics.

Instructions

Get information about a specific invite

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inviteCodeYesThe invite code (without discord.gg/)

Implementation Reference

  • The handler function that executes the tool logic: fetches Discord invite info using client.fetchInvite(inviteCode), structures the data (guild, channel, inviter, counts, etc.), handles errors with withErrorHandling, and returns JSON response.
    async ({ inviteCode }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const invite = await client.fetchInvite(inviteCode); return { code: invite.code, url: invite.url, guildId: invite.guild?.id, guildName: invite.guild?.name, guildDescription: invite.guild?.description, channelId: invite.channelId, channelName: invite.channel?.name, channelType: invite.channel?.type, inviterId: invite.inviterId, inviterUsername: invite.inviter?.username, approximateMemberCount: invite.memberCount, approximatePresenceCount: invite.presenceCount, expiresAt: invite.expiresAt?.toISOString(), targetType: invite.targetType, }; }); 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 defined with Zod: requires 'inviteCode' as a string describing the invite code without the discord.gg/ prefix.
    inviteCode: z.string().describe('The invite code (without discord.gg/)'), },
  • Registers the 'get_invite_info' tool on the MCP server, specifying name, description, input schema, and handler function.
    server.tool( 'get_invite_info', 'Get information about a specific invite', { inviteCode: z.string().describe('The invite code (without discord.gg/)'), }, async ({ inviteCode }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const invite = await client.fetchInvite(inviteCode); return { code: invite.code, url: invite.url, guildId: invite.guild?.id, guildName: invite.guild?.name, guildDescription: invite.guild?.description, channelId: invite.channelId, channelName: invite.channel?.name, channelType: invite.channel?.type, inviterId: invite.inviterId, inviterUsername: invite.inviter?.username, approximateMemberCount: invite.memberCount, approximatePresenceCount: invite.presenceCount, expiresAt: invite.expiresAt?.toISOString(), targetType: invite.targetType, }; }); 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)
    Calls registerInviteTools(server) in the main MCP server setup, which registers the get_invite_info tool along with other invite management tools.
    registerInviteTools(server);
  • src/index.ts:19-19 (registration)
    Imports the registerInviteTools function used to register invite tools including get_invite_info.
    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