Skip to main content
Glama

get_server_info

Retrieve detailed information about a specific Discord server by providing its guild ID. This tool helps users access server data for management and analysis purposes.

Instructions

Get detailed information about a specific Discord server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)

Implementation Reference

  • The handler function that executes the get_server_info tool logic, fetching detailed Discord guild information including members, channels, roles, and server settings using the Discord client.
    async ({ guildId }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const guild = await client.guilds.fetch(guildId); // Fetch additional data const channels = guild.channels.cache; const roles = guild.roles.cache; return { id: guild.id, name: guild.name, description: guild.description, memberCount: guild.memberCount, ownerId: guild.ownerId, createdAt: guild.createdAt.toISOString(), icon: guild.iconURL(), banner: guild.bannerURL(), verificationLevel: guild.verificationLevel, premiumTier: guild.premiumTier, premiumSubscriptionCount: guild.premiumSubscriptionCount, preferredLocale: guild.preferredLocale, systemChannelId: guild.systemChannelId, rulesChannelId: guild.rulesChannelId, afkChannelId: guild.afkChannelId, afkTimeout: guild.afkTimeout, features: guild.features, channelCount: channels.size, roleCount: roles.size, channels: channels.map((ch) => ({ id: ch.id, name: ch.name, type: ch.type, })), roles: roles.map((role) => ({ id: role.id, name: role.name, color: role.hexColor, position: role.position, })), }; }); if (!result.success) { return { content: [{ type: 'text', text: result.error }], isError: true }; } return { content: [ { type: 'text', text: JSON.stringify(result.data, null, 2), }, ], }; }
  • The Zod schema defining the input parameter 'guildId' for the get_server_info tool.
    { guildId: z.string().describe('The ID of the server (guild)'), },
  • The registration of the 'get_server_info' tool using server.tool(), including description, schema, and inline handler.
    server.tool( 'get_server_info', 'Get detailed information about a specific Discord 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); // Fetch additional data const channels = guild.channels.cache; const roles = guild.roles.cache; return { id: guild.id, name: guild.name, description: guild.description, memberCount: guild.memberCount, ownerId: guild.ownerId, createdAt: guild.createdAt.toISOString(), icon: guild.iconURL(), banner: guild.bannerURL(), verificationLevel: guild.verificationLevel, premiumTier: guild.premiumTier, premiumSubscriptionCount: guild.premiumSubscriptionCount, preferredLocale: guild.preferredLocale, systemChannelId: guild.systemChannelId, rulesChannelId: guild.rulesChannelId, afkChannelId: guild.afkChannelId, afkTimeout: guild.afkTimeout, features: guild.features, channelCount: channels.size, roleCount: roles.size, channels: channels.map((ch) => ({ id: ch.id, name: ch.name, type: ch.type, })), roles: roles.map((role) => ({ id: role.id, name: role.name, color: role.hexColor, position: role.position, })), }; }); 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:53-53 (registration)
    Invocation of registerServerTools which registers the get_server_info tool among others.
    registerServerTools(server);
  • src/index.ts:11-11 (registration)
    Import of the registerServerTools function that contains the get_server_info tool registration.
    import { registerServerTools } from './tools/server-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