INNER CODE UNIT · Python
list_channels
existence-master/Sentient · src/server/mcp_hub/discord/main.py:54
async def list_channels(ctx: Context, guild_id: str) -> Dict:
"""
Retrieves a list of all text and voice channels within a specified Discord server (guild), returning their names and IDs.
"""
logger.info(f"Executing tool: list_channels with guild_id='{guild_id}'")
return await _execute_tool(ctx, "list_channels", guild_id)
@mcp.tool
async def send_channel_message(ctx: Context, channel_id: str, content: str) -> Dict:
"""
Sends a text message to a specific Discord channel, identified by its `channel_id`.
"""
logger.info(f"Executing tool: send_channel_message to channel_id='{channel_id}'")
return await _execute_tool(ctx, "send_channel_message", channel_id, content)
# --- Server Execution ---
if __name__ == "__main__":
host = os.getenv("MCP_SERVER_HOST", "127.0.0.1")