Skip to main content
Glama

get_invite_info

Retrieve details about a Discord invite code to verify its validity and view server information before joining.

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 'get_invite_info' tool logic. It uses the Discord client to fetch invite details, formats the response data, handles errors with withErrorHandling, and returns JSON-formatted content or error message.
    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) }] }; }
  • Zod schema defining the input parameters for the 'get_invite_info' tool: a required 'inviteCode' string.
    { inviteCode: z.string().describe('The invite code (without discord.gg/)'), },
  • Registers the 'get_invite_info' tool with the MCP server, including 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:61-61 (registration)
    Invokes registerInviteTools to register the invite tools module (including get_invite_info) to the main MCP server instance.
    registerInviteTools(server);

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