get_channels
Retrieve a complete list of channels for any Discord server by providing the server ID. Enables users to manage and navigate server structures efficiently.
Instructions
Get a list of all channels in a Discord server
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| server_id | Yes | Discord server (guild) ID |
Implementation Reference
- src/discord_mcp/server.py:478-493 (handler)The handler implementation for the 'get_channels' tool. It retrieves the Discord guild by server_id, iterates over its channels, formats a list of channel names, IDs, and types, and returns the formatted text content.elif name == "get_channels": try: guild = discord_client.get_guild(int(arguments["server_id"])) if guild: channel_list = [] for channel in guild.channels: channel_list.append(f"#{channel.name} (ID: {channel.id}) - {channel.type}") return [TextContent( type="text", text=f"Channels in {guild.name}:\n" + "\n".join(channel_list) )] else: return [TextContent(type="text", text="Guild not found")] except Exception as e: return [TextContent(type="text", text=f"Error: {str(e)}")]
- src/discord_mcp/server.py:77-90 (registration)Registration of the 'get_channels' tool in the list_tools() function, including its name, description, and input schema requiring 'server_id'.Tool( name="get_channels", description="Get a list of all channels in a Discord server", inputSchema={ "type": "object", "properties": { "server_id": { "type": "string", "description": "Discord server (guild) ID" } }, "required": ["server_id"] } ),