discord_list_guilds
Retrieve all Discord servers accessible to the bot, enabling server management and overview within the MCP-Discord platform.
Instructions
Lists all Discord servers (guilds) the bot has access to
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "discord_list_guilds"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:506-547 (handler)Handler function for the 'discord_list_guilds' tool that lists all Discord guilds (servers) the bot has access to, including their IDs, names, member counts, and channels.
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:85-85 (schema)Zod schema for input validation of the 'discord_list_guilds' tool, which requires no parameters.
const ListGuildsSchema = z.object({}); - src/index.ts:206-213 (registration)Tool registration in the listTools response, defining name, description, and input schema for 'discord_list_guilds'.
{ name: "discord_list_guilds", description: "Lists all Discord servers (guilds) the bot has access to", inputSchema: { type: "object", properties: {}, required: [] }