Skip to main content
Glama
cdmx-in
by cdmx-in

get_user

Retrieve specific user details from the Goodday project management platform by providing a user ID for secure context-aware applications.

Instructions

Get details of a specific user.

Args: user_id: The ID of the user to retrieve

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
user_idYes

Implementation Reference

  • The handler function for the 'get_user' MCP tool. It fetches user details from the Goodday API endpoint 'user/{user_id}' and formats the response using format_user.
    @mcp.tool()
    async def get_user(user_id: str) -> str:
        """Get details of a specific user.
    
        Args:
            user_id: The ID of the user to retrieve
        """
        data = await make_goodday_request(f"user/{user_id}")
        
        if not data:
            return "User not found."
        
        if isinstance(data, dict) and "error" in data:
            return f"Unable to fetch user: {data.get('error', 'Unknown error')}"
        
        return format_user(data)
  • Helper function used by get_user to format the raw user data dictionary into a human-readable string.
    def format_user(user: dict) -> str:
        """Format a user into a readable string with safe checks."""
        if not isinstance(user, dict):
            return f"Invalid user data: {repr(user)}"
    
        # Defensive defaults in case nested keys are not dicts
        role = user.get('role') if isinstance(user.get('role'), dict) else {}
    
        return f"""
    User ID: {user.get('id', 'N/A')}
    Name: {user.get('name', 'N/A')}
    Email: {user.get('email', 'N/A')}
    Role: {role.get('name', 'N/A')}
    Status: {user.get('status', 'N/A')}
    """.strip()
  • Helper function to fetch all users and create a mapping of user IDs to names, potentially useful for resolving user names in tool outputs.
    async def get_user_mapping() -> dict:
        """Get mapping of user IDs to names."""
        data = await make_goodday_request("users")
        user_id_to_name = {}
        if isinstance(data, list):
            for u in data:
                if isinstance(u, dict):
                    user_id_to_name[u.get("id")] = u.get("name", "Unknown")
        return user_id_to_name
  • MCP tool registration decorator for the get_user function.
    @mcp.tool()

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/cdmx-in/goodday-mcp'

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