Skip to main content
Glama

list_servers

View all Discord servers where the bot is currently active to manage connections and monitor presence.

Instructions

List the Discord servers the bot is currently connected to.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function `handle_list_servers` that executes the tool logic by fetching and formatting the list of Discord guilds (servers) the bot is in.
    @staticmethod async def handle_list_servers(discord_client, arguments: Dict[str, Any]) -> List[TextContent]: """List all servers the bot has access to""" servers_info = [] for guild in discord_client.guilds: servers_info.append({ "name": guild.name, "id": guild.id, "member_count": guild.member_count, "created_at": guild.created_at.strftime('%Y-%m-%d'), "owner_id": guild.owner_id }) if not servers_info: return [TextContent(type="text", text="No servers found. Make sure the bot is invited to servers.")] # Format the server list server_list = "\n".join([ f"**{server['name']}**\n" f" - ID: {server['id']}\n" f" - Members: {server['member_count']}\n" f" - Created: {server['created_at']}\n" for server in servers_info ]) return [TextContent( type="text", text=f"**Available Servers ({len(servers_info)}):**\n\n{server_list}" )]
  • Registration of the 'list_servers' tool in the MCP server's tool list, including its description and empty input schema.
    Tool( name="list_servers", description="Get a list of all Discord servers the bot has access to with detailed information", inputSchema={ "type": "object", "properties": {}, "required": [] } ) ]
  • Routing logic in `call_tool` that maps the 'list_servers' tool name to the corresponding handler method in CoreToolHandlers.
    core_tool_names = [ "get_server_info", "list_servers", "get_channels", "list_members", "get_user_info", "send_message", "read_messages", "add_reaction", "add_multiple_reactions", "remove_reaction", "moderate_message", "create_text_channel", "delete_channel", "add_role", "remove_role" ] if name in core_tool_names: handler_method = f"handle_{name}" if hasattr(CoreToolHandlers, handler_method): return await getattr(CoreToolHandlers, handler_method)(discord_client, arguments)

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

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