discord_get_server_stats
Retrieve Discord server statistics including member counts, channel details, roles, and boost level to monitor community growth and structure.
Instructions
Get server statistics: member count (humans vs bots), channels, roles, boost level.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| guild_id | Yes |
Implementation Reference
- src/tools/stats.ts:24-45 (handler)The logic for handling the discord_get_server_stats tool, which fetches guild data and compiles statistics.
case "discord_get_server_stats": { const guild = await (await discord.guilds.fetch(validateId(args.guild_id, "guild_id"))).fetch(); await guild.channels.fetch(); const cachedBots = guild.members.cache.filter((m) => m.user.bot).size; return { content: [{ type: "text", text: JSON.stringify({ name: guild.name, totalMembers: guild.memberCount, humans: guild.memberCount - cachedBots, botsInCache: cachedBots, channels: { total: guild.channels.cache.size, text: guild.channels.cache.filter((c) => c.type === ChannelType.GuildText).size, voice: guild.channels.cache.filter((c) => c.type === ChannelType.GuildVoice).size, categories: guild.channels.cache.filter((c) => c.type === ChannelType.GuildCategory).size, }, roles: guild.roles.cache.size - 1, boostLevel: guild.premiumTier, boostCount: guild.premiumSubscriptionCount ?? 0, createdAt: guild.createdAt.toISOString(), }, null, 2), }], }; } - src/tools/stats.ts:7-15 (schema)The MCP tool definition for discord_get_server_stats, including the input schema.
{ name: "discord_get_server_stats", description: "Get server statistics: member count (humans vs bots), channels, roles, boost level.", inputSchema: { type: "object", properties: { guild_id: { type: "string" } }, required: ["guild_id"], }, },