Skip to main content
Glama

gitlab_get_user

Retrieve basic GitLab user profile details (name, username, avatar) by providing a specific user ID or exact username. Use this tool for tasks like identifying @mentions or verifying commit authors.

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

TableJSON Schema
NameRequiredDescriptionDefault
user_idNoUser ID (numeric) Type: integer Format: Numeric user ID Example: 12345 How to find: From user profile URL or API responses
usernameNoGitLab 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

  • The main handler function that implements the gitlab_get_user tool logic. It extracts user_id or username from arguments, calls client.get_user(), handles missing params and not found errors, and returns the user details.
    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
  • Pydantic/MCP schema definition for the gitlab_get_user tool input, specifying 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} } } ),
  • TOOL_HANDLERS dictionary maps the tool name TOOL_GET_USER ("gitlab_get_user") to its handler function handle_get_user. This dict is used by server.py to dispatch tool calls.
    TOOL_HANDLERS = { # List tools TOOL_LIST_PROJECTS: handle_list_projects, TOOL_LIST_ISSUES: handle_list_issues, TOOL_LIST_MRS: handle_list_merge_requests, TOOL_LIST_BRANCHES: handle_list_branches, TOOL_LIST_PIPELINES: handle_list_pipelines, TOOL_LIST_USER_EVENTS: handle_get_user_events, TOOL_LIST_COMMITS: handle_get_commits, TOOL_LIST_REPOSITORY_TREE: handle_get_repository_tree, TOOL_LIST_TAGS: handle_get_tags, TOOL_LIST_RELEASES: handle_list_releases, TOOL_LIST_PROJECT_MEMBERS: handle_get_project_members, TOOL_LIST_PROJECT_HOOKS: handle_get_project_hooks, TOOL_LIST_GROUPS: handle_list_groups, TOOL_LIST_GROUP_PROJECTS: handle_list_group_projects, TOOL_LIST_SNIPPETS: handle_list_snippets, TOOL_LIST_PIPELINE_JOBS: handle_list_pipeline_jobs, TOOL_LIST_PROJECT_JOBS: handle_list_project_jobs, # Get tools TOOL_GET_PROJECT: handle_get_project, TOOL_GET_CURRENT_PROJECT: handle_get_current_project, TOOL_GET_MR_NOTES: handle_get_merge_request_notes, TOOL_GET_CURRENT_USER: handle_get_current_user, TOOL_GET_USER: handle_get_user, TOOL_GET_GROUP: handle_get_group, TOOL_GET_SNIPPET: handle_get_snippet, TOOL_DOWNLOAD_JOB_ARTIFACT: handle_download_job_artifact, TOOL_GET_ISSUE: handle_get_issue, TOOL_GET_MERGE_REQUEST: handle_get_merge_request, TOOL_GET_FILE_CONTENT: handle_get_file_content, TOOL_GET_COMMIT: handle_get_commit, TOOL_GET_COMMIT_DIFF: handle_get_commit_diff, TOOL_GET_MR_APPROVALS: handle_get_merge_request_approvals, TOOL_GET_MR_DISCUSSIONS: handle_get_merge_request_discussions, TOOL_GET_MR_CHANGES: handle_get_merge_request_changes, # Action tools TOOL_CREATE_SNIPPET: handle_create_snippet, TOOL_UPDATE_SNIPPET: handle_update_snippet, TOOL_UPDATE_MR: handle_update_merge_request, TOOL_CLOSE_MR: handle_close_merge_request, TOOL_MERGE_MR: handle_merge_merge_request, TOOL_REBASE_MR: handle_rebase_merge_request, TOOL_APPROVE_MR: handle_approve_merge_request, TOOL_ADD_ISSUE_COMMENT: handle_add_issue_comment, TOOL_ADD_MR_COMMENT: handle_add_merge_request_comment, TOOL_RESOLVE_DISCUSSION: handle_resolve_discussion, TOOL_CREATE_COMMIT: handle_create_commit, TOOL_CHERRY_PICK_COMMIT: handle_cherry_pick_commit, TOOL_COMPARE_REFS: handle_compare_refs, # Search tools TOOL_SEARCH_PROJECTS: handle_search_projects, TOOL_SEARCH_IN_PROJECT: handle_search_in_project, # AI and Advanced Tools TOOL_SUMMARIZE_MR: handle_summarize_merge_request, TOOL_SUMMARIZE_ISSUE: handle_summarize_issue, TOOL_SUMMARIZE_PIPELINE: handle_summarize_pipeline, TOOL_SMART_DIFF: handle_smart_diff, TOOL_SAFE_PREVIEW_COMMIT: handle_safe_preview_commit, TOOL_BATCH_OPERATIONS: handle_batch_operations, # Job and Artifact handlers TOOL_LIST_PIPELINE_JOBS: handle_list_pipeline_jobs, TOOL_DOWNLOAD_JOB_ARTIFACT: handle_download_job_artifact, TOOL_LIST_PROJECT_JOBS: handle_list_project_jobs, # User & Profile handlers TOOL_SEARCH_USER: handle_search_user, TOOL_GET_USER_DETAILS: handle_get_user_details, TOOL_GET_MY_PROFILE: handle_get_my_profile, TOOL_GET_USER_CONTRIBUTIONS_SUMMARY: handle_get_user_contributions_summary, TOOL_GET_USER_ACTIVITY_FEED: handle_get_user_activity_feed, # User's Issues & MRs handlers TOOL_GET_USER_OPEN_MRS: handle_get_user_open_mrs, TOOL_GET_USER_REVIEW_REQUESTS: handle_get_user_review_requests, TOOL_GET_USER_OPEN_ISSUES: handle_get_user_open_issues, TOOL_GET_USER_REPORTED_ISSUES: handle_get_user_reported_issues, TOOL_GET_USER_RESOLVED_ISSUES: handle_get_user_resolved_issues, # User's Code & Commits handlers TOOL_GET_USER_COMMITS: handle_get_user_commits, TOOL_GET_USER_MERGE_COMMITS: handle_get_user_merge_commits, TOOL_GET_USER_CODE_CHANGES_SUMMARY: handle_get_user_code_changes_summary, TOOL_GET_USER_SNIPPETS: handle_get_user_snippets, # User's Comments & Discussions handlers TOOL_GET_USER_ISSUE_COMMENTS: handle_get_user_issue_comments, TOOL_GET_USER_MR_COMMENTS: handle_get_user_mr_comments, TOOL_GET_USER_DISCUSSION_THREADS: handle_get_user_discussion_threads, TOOL_GET_USER_RESOLVED_THREADS: handle_get_user_resolved_threads, }
  • Constant definition for the tool name "gitlab_get_user", used throughout for consistency in registration, schemas, and tests.
    TOOL_GET_USER = "gitlab_get_user"
  • Tool registration in server.py's handle_list_tools(), which exposes the tool schema to MCP clients.
    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} } } ),

Other Tools

Related 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/Vijay-Duke/mcp-gitlab'

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