Skip to main content
Glama
wowjinxy
by wowjinxy

list_invites

View active invitation links for a Discord server to manage access and share invites.

Instructions

List active invites for a server.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
server_idNo

Implementation Reference

  • The main handler function for the 'list_invites' tool. It fetches all active invites from the specified Discord guild using guild.invites(), formats details like code, channel, inviter, expiry, and usage, and returns a formatted string list.
    async def list_invites(server_id: str | int | None = None, ctx: Context = None) -> str:  # type: ignore[override]
        """List active invites for a server."""
    
        assert ctx is not None
        bot, config = await _acquire(ctx)
        guild_id = _resolve_guild_id(config, server_id)
        guild = await _ensure_guild(bot, guild_id)
    
        invites = await _call_discord("list invites", guild.invites())
        if not invites:
            return f"No active invites found for {guild.name}."
    
        lines = [f"**Active invites for {guild.name}:**"]
        for invite in invites:
            inviter = invite.inviter.display_name if invite.inviter else "Unknown"
            expires = _format_timestamp(invite.expires_at) if invite.expires_at else "No expiry"
            usage = f"{invite.uses or 0}/{invite.max_uses or '∞'} uses"
            lines.append(
                f"• {invite.code} – Channel: {getattr(invite.channel, 'name', invite.channel_id)} – "
                f"Inviter: {inviter} – Expires: {expires} – {usage}"
            )
    
        return "\n".join(lines)

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/wowjinxy/mcp-discord'

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