Skip to main content
Glama
jar285

MCP-Discord

by jar285

discord_list_guilds

Retrieve a list of all Discord servers the bot is authorized to access, enabling efficient server management and monitoring within the MCP-Discord ecosystem.

Instructions

Lists all Discord servers (guilds) the bot has access to

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler for the discord_list_guilds tool. Validates input with ListGuildsSchema, checks if Discord client is ready, fetches guilds from client.guilds.cache, maps guild details including channels, and returns formatted JSON string of available guilds.
    case "discord_list_guilds": { ListGuildsSchema.parse(args); try { if (!client.isReady()) { return { content: [{ type: "text", text: "Discord client not logged in. Please use discord_login tool first." }], isError: true }; } // Get all guilds the bot is in const guilds = client.guilds.cache.map(guild => ({ id: guild.id, name: guild.name, memberCount: guild.memberCount, channels: guild.channels.cache.map(channel => ({ id: channel.id, name: channel.name, type: channel.type })) })); if (guilds.length === 0) { return { content: [{ type: "text", text: "The bot is not a member of any Discord servers." }] }; } return { content: [{ type: "text", text: `Available Discord Servers:\n${JSON.stringify(guilds, null, 2)}` }] }; } catch (error) { return { content: [{ type: "text", text: `Failed to list guilds: ${error}` }], isError: true }; } }
  • src/index.ts:206-214 (registration)
    Tool registration in the ListToolsRequestHandler, defining name, description, and empty input schema matching ListGuildsSchema.
    { name: "discord_list_guilds", description: "Lists all Discord servers (guilds) the bot has access to", inputSchema: { type: "object", properties: {}, required: [] } },
  • Zod schema for input validation of discord_list_guilds tool, defining an empty object schema.
    const ListGuildsSchema = z.object({});

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

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