gitlab_get_user
Retrieve basic profile information for a specific GitLab user by providing their ID or exact username. Returns essential details like name, username, avatar, and public profile data.
Instructions
Get basic profile information for a specific GitLab user by ID or username.
Returns essential user details like name, username, avatar, and public profile info. Use this tool when you have a specific user ID or exact username and need basic profile information.
Parameters:
user_id: Numeric user ID (e.g., 12345)
username: Username string (e.g., 'johndoe')
Use either user_id OR username, not both.
Examples:
Get user profile for @mentions: get_user(username="johndoe")
Look up user from commit author: get_user(user_id=12345)
Display user info in applications
For searching users with partial information, use 'gitlab_search_user' instead. For comprehensive user activity and contributions, use user activity tools instead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_id | No | User ID (numeric) Type: integer Format: Numeric user ID Example: 12345 How to find: From user profile URL or API responses | |
| username | No | GitLab username Type: string Format: Username without @ symbol Case: Case-sensitive Required: Yes Examples: - 'johndoe' (for @johndoe) - 'mary-smith' (for @mary-smith) - 'user123' (for @user123) Note: This is the username, not display name or email |
Implementation Reference
- src/mcp_gitlab/tool_handlers.py:258-271 (handler)The handler function that executes the core logic of the gitlab_get_user tool by calling the GitLabClient's get_user method with either user_id or username.def handle_get_user(client: GitLabClient, arguments: Optional[Dict[str, Any]]) -> Dict[str, Any]: """Handle getting user details by ID or username""" user_id = get_argument(arguments, "user_id") username = get_argument(arguments, "username") if not user_id and not username: raise ValueError("Either user_id or username must be provided") result = client.get_user(user_id=user_id, username=username) if result is None: raise ValueError(f"User not found: {user_id or username}") return result
- src/mcp_gitlab/tool_handlers.py:1027-1027 (registration)Registration of the handler function in the TOOL_HANDLERS dictionary, mapping the tool name 'gitlab_get_user' to its handler.TOOL_GET_USER: handle_get_user,
- src/mcp_gitlab/server.py:210-220 (schema)MCP tool schema definition in list_tools(), specifying the input schema requiring either user_id (integer) or username (string).types.Tool( name=TOOL_GET_USER, description=desc.DESC_GET_USER, inputSchema={ "type": "object", "properties": { "user_id": {"type": "integer", "description": desc.DESC_USER_ID}, "username": {"type": "string", "description": desc.DESC_USERNAME} } } ),
- src/mcp_gitlab/constants.py:188-188 (registration)Constant defining the tool name 'gitlab_get_user' used for registration and mapping throughout the codebase.TOOL_GET_USER = "gitlab_get_user"