Skip to main content
Glama

get_user_info

Retrieve Slack user information by entering a display name or real name to identify team members and access their details.

Instructions

Get Slack user info by username or real name.

Args:
    username: Slack display name or real name (not user ID).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • main.py:57-94 (handler)
    The main handler function for the 'get_user_info' tool. It is registered via the @mcp.tool() decorator and implements the logic to retrieve Slack user information by searching the users.list and then fetching detailed info with users.info.
    @mcp.tool()
    async def get_user_info(username: str) -> str:
        """
        Get Slack user info by username or real name.
    
        Args:
            username: Slack display name or real name (not user ID).
        """
        # Step 1: Get list of all users
        users_data = await make_slack_request("users.list")
        if not users_data or not users_data.get("ok"):
            return "❌ Failed to fetch user list."
    
        # Step 2: Search for the user
        user_id = None
        for user in users_data["members"]:
            if user.get("name") == username or user.get("real_name") == username:
                user_id = user["id"]
                break
    
        if not user_id:
            return f"❌ User '{username}' not found."
    
        # Step 3: Use user_id to get full user info
        params = {"user": user_id}
        data = await make_slack_request("users.info", params)
        if not data or not data.get("ok"):
            return "❌ Failed to fetch user info."
    
        user = data.get("user", {})
        profile = user.get("profile", {})
    
        return (
            f"👤 Username: {user.get('name')}\n"
            f"🧾 Real Name: {user.get('real_name')}\n"
            f"📧 Email: {profile.get('email', 'N/A')}\n"
            f"🆔 ID: {user_id}"
        )

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

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/Abu-BakarYasir/my_slack_mcp'

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