Skip to main content
Glama

gitlab_get_user_activity_feed

Retrieve a chronological feed of user activities including commits, issues, merge requests, and comments across GitLab projects to track engagement, monitor workflows, and generate reports.

Instructions

Retrieve user's complete activity/events timeline

Get chronological feed of all user activities including commits, issues, MRs, comments, and other interactions across all accessible projects.

Returns activity timeline with:

  • Event details: type, target, description

  • Timestamps: creation and update times

  • Project context: where activity occurred

  • Related objects: linked issues, MRs, commits

  • Action metadata: push details, comment excerpts

Use cases:

  • Track user engagement patterns

  • Monitor team member activities

  • Generate activity reports

  • Debug user workflow issues

Parameters:

  • user_id: Numeric user ID

  • username: Username string (use either user_id or username)

  • action: Filter by action type (created, updated, closed, merged, etc.)

  • target_type: Filter by target (Issue, MergeRequest, Project, etc.)

  • after: Events after this date (YYYY-MM-DD)

  • before: Events before this date (YYYY-MM-DD)

  • per_page: Results per page (default: 20)

  • page: Page number (default: 1)

Example: Get recent issue activities

{
  "username": "johndoe", 
  "target_type": "Issue",
  "after": "2024-01-01"
}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
user_idNoNumeric user ID
usernameNoUsername string
actionNoFilter by action type
target_typeNoFilter by target type
afterNoEvents after this date (YYYY-MM-DD)
beforeNoEvents before this date (YYYY-MM-DD)
per_pageNoNumber of results per page Type: integer Range: 1-100 Default: 20 Example: 50 (for faster browsing) Tip: Use smaller values (10-20) for detailed operations, larger (50-100) for listing
pageNoPage number for pagination Type: integer Range: ≥1 Default: 1 Example: 3 (to get the third page of results) Note: Use with per_page to navigate large result sets

Implementation Reference

  • The primary handler function for the gitlab_get_user_activity_feed tool. It parses input arguments using helper functions and calls the underlying GitLabClient.get_user_activity_feed method to retrieve and return the user's recent activity events.
    def handle_get_user_activity_feed(client: GitLabClient, arguments: Optional[Dict[str, Any]]) -> Dict[str, Any]:
        """Handle getting user activity feed"""
        user_id = get_argument(arguments, "user_id")
        username = get_argument(arguments, "username")
        action = get_argument(arguments, "action")
        target_type = get_argument(arguments, "target_type")
        after = get_argument(arguments, "after")
        before = get_argument(arguments, "before")
        per_page = get_argument(arguments, "per_page", DEFAULT_PAGE_SIZE)
        page = get_argument(arguments, "page", 1)
        
        return client.get_user_activity_feed(
            user_id=user_id,
            username=username,
            action=action,
            target_type=target_type,
            after=after,
            before=before,
            per_page=per_page,
            page=page
        )
  • Pydantic/MCP schema definition for the tool, including input schema with properties like username (required), action, target_type, pagination parameters, and enums for filtering user events.
    types.Tool(
        name=TOOL_GET_USER_ACTIVITY_FEED,
        description=desc.DESC_GET_USER_ACTIVITY_FEED,
        inputSchema={
            "type": "object",
            "properties": {
                "username": {"type": "string", "description": "Username string"},
                "action": {"type": "string", "description": "Event action type", "enum": ["created", "updated", "closed", "reopened", "pushed", "commented", "merged", "joined", "left", "destroyed", "expired", "approved"]},
                "target_type": {"type": "string", "description": "Event target type", "enum": ["issue", "milestone", "merge_request", "note", "project", "snippet", "user", "wiki"]},
                "per_page": {"type": "integer", "description": desc.DESC_PER_PAGE, "default": SMALL_PAGE_SIZE, "minimum": 1, "maximum": MAX_PAGE_SIZE},
                "page": {"type": "integer", "description": desc.DESC_PAGE_NUMBER, "default": 1, "minimum": 1}
            },
            "required": ["username"]
        }
    ),
  • Maps the tool name constant to its handler function in the central TOOL_HANDLERS dictionary, which is used by server.py's @server.call_tool() dispatcher to route tool calls.
    TOOL_GET_USER_ACTIVITY_FEED: handle_get_user_activity_feed,
  • Imports the TOOL_HANDLERS dictionary in the main server.py file where tool dispatch occurs via TOOL_HANDLERS.get(name) in @server.call_tool().
        from .tool_handlers import TOOL_HANDLERS, get_project_id_or_detect
        from . import tool_descriptions as desc
    except ImportError as e:
        # Fallback imports for development/testing when package is not installed
        import sys
        import os
        from pathlib import Path
        
        # Add the parent directory to sys.path to allow imports
        src_path = Path(__file__).resolve().parent.parent
        sys.path.insert(0, str(src_path))
        
        try:
            from mcp_gitlab.gitlab_client import GitLabClient, GitLabConfig
            from mcp_gitlab.git_detector import GitDetector
            from mcp_gitlab.utils import GitLabClientManager, sanitize_error, truncate_response
            from mcp_gitlab.constants import (
                DEFAULT_GITLAB_URL, DEFAULT_PAGE_SIZE, SMALL_PAGE_SIZE, MAX_PAGE_SIZE,
                DEFAULT_MAX_BODY_LENGTH, MAX_RESPONSE_SIZE, LOG_LEVEL, LOG_FORMAT,
                JSON_LOGGING, ERROR_NO_TOKEN, ERROR_AUTH_FAILED, ERROR_NOT_FOUND,
                ERROR_RATE_LIMIT, ERROR_GENERIC, ERROR_NO_PROJECT, ERROR_INVALID_INPUT,
                TOOL_LIST_PROJECTS, TOOL_GET_PROJECT, TOOL_GET_CURRENT_PROJECT,
                TOOL_LIST_ISSUES, TOOL_LIST_MRS, TOOL_GET_MR_NOTES,
                TOOL_LIST_BRANCHES, TOOL_LIST_PIPELINES,
                TOOL_LIST_COMMITS, TOOL_LIST_REPOSITORY_TREE, TOOL_LIST_TAGS,
                TOOL_LIST_USER_EVENTS, TOOL_LIST_PROJECT_MEMBERS, TOOL_LIST_PROJECT_HOOKS,
                TOOL_LIST_RELEASES, TOOL_GET_CURRENT_USER, TOOL_GET_USER,
                TOOL_LIST_GROUPS, TOOL_GET_GROUP, TOOL_LIST_GROUP_PROJECTS,
                TOOL_LIST_SNIPPETS, TOOL_GET_SNIPPET, TOOL_CREATE_SNIPPET,
                TOOL_UPDATE_SNIPPET, TOOL_LIST_PIPELINE_JOBS, TOOL_DOWNLOAD_JOB_ARTIFACT, TOOL_LIST_PROJECT_JOBS,
                TOOL_SEARCH_USER, TOOL_GET_USER_DETAILS, TOOL_GET_MY_PROFILE,
                TOOL_GET_USER_CONTRIBUTIONS_SUMMARY, TOOL_GET_USER_ACTIVITY_FEED,
                TOOL_GET_USER_OPEN_MRS, TOOL_GET_USER_REVIEW_REQUESTS, TOOL_GET_USER_OPEN_ISSUES,
                TOOL_GET_USER_REPORTED_ISSUES, TOOL_GET_USER_RESOLVED_ISSUES,
                TOOL_GET_USER_COMMITS, TOOL_GET_USER_MERGE_COMMITS,
                TOOL_GET_USER_CODE_CHANGES_SUMMARY, TOOL_GET_USER_SNIPPETS,
                TOOL_GET_USER_ISSUE_COMMENTS, TOOL_GET_USER_MR_COMMENTS,
                TOOL_GET_USER_DISCUSSION_THREADS, TOOL_GET_USER_RESOLVED_THREADS
            )
            from mcp_gitlab.tool_handlers import TOOL_HANDLERS, get_project_id_or_detect
            import mcp_gitlab.tool_descriptions as desc
        except ImportError:
            # If mcp_gitlab package doesn't exist, try direct imports
            from gitlab_client import GitLabClient, GitLabConfig
            from git_detector import GitDetector
            from utils import GitLabClientManager, sanitize_error, truncate_response
            from constants import (
                DEFAULT_GITLAB_URL, DEFAULT_PAGE_SIZE, SMALL_PAGE_SIZE, MAX_PAGE_SIZE,
                DEFAULT_MAX_BODY_LENGTH, MAX_RESPONSE_SIZE, LOG_LEVEL, LOG_FORMAT,
                JSON_LOGGING, ERROR_NO_TOKEN, ERROR_AUTH_FAILED, ERROR_NOT_FOUND,
                ERROR_RATE_LIMIT, ERROR_GENERIC, ERROR_NO_PROJECT, ERROR_INVALID_INPUT,
                TOOL_LIST_PROJECTS, TOOL_GET_PROJECT, TOOL_GET_CURRENT_PROJECT,
                TOOL_LIST_ISSUES, TOOL_LIST_MRS, TOOL_GET_MR_NOTES,
                TOOL_LIST_BRANCHES, TOOL_LIST_PIPELINES,
                TOOL_LIST_COMMITS, TOOL_LIST_REPOSITORY_TREE, TOOL_LIST_TAGS,
                TOOL_LIST_USER_EVENTS, TOOL_LIST_PROJECT_MEMBERS, TOOL_LIST_PROJECT_HOOKS,
                TOOL_LIST_RELEASES, TOOL_GET_CURRENT_USER, TOOL_GET_USER,
                TOOL_LIST_GROUPS, TOOL_GET_GROUP, TOOL_LIST_GROUP_PROJECTS,
                TOOL_LIST_SNIPPETS, TOOL_GET_SNIPPET, TOOL_CREATE_SNIPPET,
                TOOL_UPDATE_SNIPPET, TOOL_LIST_PIPELINE_JOBS, TOOL_DOWNLOAD_JOB_ARTIFACT, TOOL_LIST_PROJECT_JOBS,
                TOOL_SEARCH_USER, TOOL_GET_USER_DETAILS, TOOL_GET_MY_PROFILE,
                TOOL_GET_USER_CONTRIBUTIONS_SUMMARY, TOOL_GET_USER_ACTIVITY_FEED,
                TOOL_GET_USER_OPEN_MRS, TOOL_GET_USER_REVIEW_REQUESTS, TOOL_GET_USER_OPEN_ISSUES,
                TOOL_GET_USER_REPORTED_ISSUES, TOOL_GET_USER_RESOLVED_ISSUES,
                TOOL_GET_USER_COMMITS, TOOL_GET_USER_MERGE_COMMITS,
                TOOL_GET_USER_CODE_CHANGES_SUMMARY, TOOL_GET_USER_SNIPPETS,
                TOOL_GET_USER_ISSUE_COMMENTS, TOOL_GET_USER_MR_COMMENTS,
                TOOL_GET_USER_DISCUSSION_THREADS, TOOL_GET_USER_RESOLVED_THREADS
            )
            from tool_handlers import TOOL_HANDLERS, get_project_id_or_detect
            import tool_descriptions as desc
    
    load_dotenv()
    
    # Configure logging based on environment settings
    if JSON_LOGGING:
        # Use python-json-logger for structured logging
        from pythonjsonlogger import jsonlogger
        
        handler = logging.StreamHandler()
        formatter = jsonlogger.JsonFormatter(
            fmt='%(timestamp)s %(level)s %(name)s %(message)s',
            rename_fields={'timestamp': 'asctime', 'level': 'levelname'}
        )
        handler.setFormatter(formatter)
        
        # Configure root logger
        logging.root.handlers = [handler]
        logging.root.setLevel(getattr(logging, LOG_LEVEL.upper()))
    else:
        # Use traditional logging format
        logging.basicConfig(
            level=getattr(logging, LOG_LEVEL.upper()),
            format=LOG_FORMAT
        )
    
    logger = logging.getLogger(__name__)
    
    server = Server("mcp-gitlab")
    client_manager = GitLabClientManager()
    
    
    def get_gitlab_client() -> GitLabClient:
        """Get GitLab client using singleton manager"""
        config = GitLabConfig(
            url=os.getenv("GITLAB_URL", DEFAULT_GITLAB_URL),
            private_token=os.getenv("GITLAB_PRIVATE_TOKEN"),
            oauth_token=os.getenv("GITLAB_OAUTH_TOKEN")
        )
        return client_manager.get_client(config)
    
    
    
    
    @server.list_tools()
    async def handle_list_tools() -> List[types.Tool]:
        """List all available GitLab tools"""
        return [
            # Project Management
            types.Tool(
                name=TOOL_LIST_PROJECTS,
                description=desc.DESC_LIST_PROJECTS,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "owned": {"type": "boolean", "description": desc.DESC_OWNED_PROJECTS, "default": False},
                        "search": {"type": "string", "description": desc.DESC_SEARCH_TERM + " for projects"},
                        "per_page": {"type": "integer", "description": desc.DESC_PER_PAGE, "default": DEFAULT_PAGE_SIZE, "minimum": 1, "maximum": MAX_PAGE_SIZE},
                        "page": {"type": "integer", "description": desc.DESC_PAGE_NUMBER, "default": 1, "minimum": 1}
                    }
                }
            ),
            types.Tool(
                name=TOOL_GET_PROJECT,
                description=desc.DESC_GET_PROJECT,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID_REQUIRED}
                    },
                    "required": ["project_id"]
                }
            ),
            types.Tool(
                name=TOOL_GET_CURRENT_PROJECT,
                description=desc.DESC_GET_CURRENT_PROJECT,
                inputSchema={
                    "type": "object", 
                    "properties": {
                        "path": {"type": "string", "description": desc.DESC_GIT_PATH}
                    }
                }
            ),
            
            # Authentication & User Info
            types.Tool(
                name=TOOL_GET_CURRENT_USER,
                description=desc.DESC_GET_CURRENT_USER,
                inputSchema={
                    "type": "object",
                    "properties": {}
                }
            ),
            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}
                    }
                }
            ),
            
            # Group Management
            types.Tool(
                name=TOOL_LIST_GROUPS,
                description=desc.DESC_LIST_GROUPS,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "search": {"type": "string", "description": desc.DESC_SEARCH_TERM + " for groups"},
                        "owned": {"type": "boolean", "description": desc.DESC_OWNED_GROUPS, "default": False},
                        "per_page": {"type": "integer", "description": desc.DESC_PER_PAGE, "default": DEFAULT_PAGE_SIZE, "minimum": 1, "maximum": MAX_PAGE_SIZE},
                        "page": {"type": "integer", "description": desc.DESC_PAGE_NUMBER, "default": 1, "minimum": 1}
                    }
                }
            ),
            types.Tool(
                name=TOOL_GET_GROUP,
                description=desc.DESC_GET_GROUP,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "group_id": {"type": "string", "description": desc.DESC_GROUP_ID},
                        "with_projects": {"type": "boolean", "description": desc.DESC_WITH_PROJECTS, "default": False}
                    },
                    "required": ["group_id"]
                }
            ),
            types.Tool(
                name=TOOL_LIST_GROUP_PROJECTS,
                description=desc.DESC_LIST_GROUP_PROJECTS,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "group_id": {"type": "string", "description": desc.DESC_GROUP_ID},
                        "search": {"type": "string", "description": desc.DESC_SEARCH_TERM + " for projects"},
                        "include_subgroups": {"type": "boolean", "description": desc.DESC_INCLUDE_SUBGROUPS, "default": False},
                        "per_page": {"type": "integer", "description": desc.DESC_PER_PAGE, "default": DEFAULT_PAGE_SIZE, "minimum": 1, "maximum": MAX_PAGE_SIZE},
                        "page": {"type": "integer", "description": desc.DESC_PAGE_NUMBER, "default": 1, "minimum": 1}
                    },
                    "required": ["group_id"]
                }
            ),
            
            # Issues
            types.Tool(
                name=TOOL_LIST_ISSUES,
                description=desc.DESC_LIST_ISSUES,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                        "state": {"type": "string", "description": desc.DESC_STATE_ISSUE, "enum": ["opened", "closed", "all"], "default": "opened"},
                        "per_page": {"type": "integer", "description": desc.DESC_PER_PAGE, "default": DEFAULT_PAGE_SIZE, "minimum": 1, "maximum": MAX_PAGE_SIZE},
                        "page": {"type": "integer", "description": desc.DESC_PAGE_NUMBER, "default": 1, "minimum": 1}
                    }
                }
            ),
            types.Tool(
                name="gitlab_get_issue",
                description=desc.DESC_GET_ISSUE,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                        "issue_iid": {"type": "integer", "description": desc.DESC_ISSUE_IID}
                    },
                    "required": ["issue_iid"]
                }
            ),
            
            # Merge Requests  
            types.Tool(
                name=TOOL_LIST_MRS,
                description=desc.DESC_LIST_MRS,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                        "state": {"type": "string", "description": desc.DESC_STATE_MR, "enum": ["opened", "closed", "merged", "all"], "default": "opened"},
                        "per_page": {"type": "integer", "description": desc.DESC_PER_PAGE, "default": DEFAULT_PAGE_SIZE, "minimum": 1, "maximum": MAX_PAGE_SIZE},
                        "page": {"type": "integer", "description": desc.DESC_PAGE_NUMBER, "default": 1, "minimum": 1}
                    }
                }
            ),
            types.Tool(
                name="gitlab_get_merge_request",
                description=desc.DESC_GET_MR,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                        "mr_iid": {"type": "integer", "description": desc.DESC_MR_IID}
                    },
                    "required": ["mr_iid"]
                }
            ),
            types.Tool(
                name=TOOL_GET_MR_NOTES,
                description=desc.DESC_GET_MR_NOTES,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                        "mr_iid": {"type": "integer", "description": desc.DESC_MR_IID},
                        "per_page": {"type": "integer", "description": desc.DESC_PER_PAGE, "default": SMALL_PAGE_SIZE, "minimum": 1, "maximum": MAX_PAGE_SIZE},
                        "page": {"type": "integer", "description": desc.DESC_PAGE_NUMBER, "default": 1, "minimum": 1},
                        "sort": {"type": "string", "description": desc.DESC_SORT_ORDER, "enum": ["asc", "desc"], "default": "asc"},
                        "order_by": {"type": "string", "description": desc.DESC_ORDER_BY, "enum": ["created_at", "updated_at"], "default": "created_at"},
                        "max_body_length": {"type": "integer", "description": desc.DESC_MAX_BODY_LENGTH, "default": DEFAULT_MAX_BODY_LENGTH, "minimum": 0}
                    },
                    "required": ["mr_iid"]
                }
            ),
            
            # Repository Files
            types.Tool(
                name="gitlab_get_file_content",
                description=desc.DESC_GET_FILE_CONTENT,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                        "file_path": {"type": "string", "description": desc.DESC_FILE_PATH},
                        "ref": {"type": "string", "description": desc.DESC_REF}
                    },
                    "required": ["file_path"]
                }
            ),
            types.Tool(
                name=TOOL_LIST_REPOSITORY_TREE,
                description=desc.DESC_LIST_TREE,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                        "path": {"type": "string", "description": desc.DESC_TREE_PATH, "default": ""},
                        "ref": {"type": "string", "description": desc.DESC_REF},
                        "recursive": {"type": "boolean", "description": desc.DESC_RECURSIVE, "default": False}
                    }
                }
            ),
            
            # Snippets
            types.Tool(
                name=TOOL_LIST_SNIPPETS,
                description=desc.DESC_LIST_SNIPPETS,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                        "per_page": {"type": "integer", "description": desc.DESC_PER_PAGE, "default": DEFAULT_PAGE_SIZE, "minimum": 1, "maximum": MAX_PAGE_SIZE},
                        "page": {"type": "integer", "description": desc.DESC_PAGE_NUMBER, "default": 1, "minimum": 1}
                    }
                }
            ),
            types.Tool(
                name=TOOL_GET_SNIPPET,
                description=desc.DESC_GET_SNIPPET,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                        "snippet_id": {"type": "integer", "description": desc.DESC_SNIPPET_ID}
                    },
                    "required": ["snippet_id"]
                }
            ),
            types.Tool(
                name=TOOL_CREATE_SNIPPET,
                description=desc.DESC_CREATE_SNIPPET,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                        "title": {"type": "string", "description": desc.DESC_SNIPPET_TITLE},
                        "file_name": {"type": "string", "description": desc.DESC_SNIPPET_FILE_NAME},
                        "content": {"type": "string", "description": desc.DESC_SNIPPET_CONTENT},
                        "description": {"type": "string", "description": desc.DESC_SNIPPET_DESCRIPTION},
                        "visibility": {"type": "string", "description": desc.DESC_SNIPPET_VISIBILITY, "enum": ["private", "internal", "public"], "default": "private"}
                    },
                    "required": ["title", "file_name", "content"]
                }
            ),
            types.Tool(
                name=TOOL_UPDATE_SNIPPET,
                description=desc.DESC_UPDATE_SNIPPET,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                        "snippet_id": {"type": "integer", "description": desc.DESC_SNIPPET_ID},
                        "title": {"type": "string", "description": desc.DESC_SNIPPET_TITLE},
                        "file_name": {"type": "string", "description": desc.DESC_SNIPPET_FILE_NAME},
                        "content": {"type": "string", "description": desc.DESC_SNIPPET_CONTENT},
                        "description": {"type": "string", "description": desc.DESC_SNIPPET_DESCRIPTION},
                        "visibility": {"type": "string", "description": desc.DESC_SNIPPET_VISIBILITY, "enum": ["private", "internal", "public"]}
                    },
                    "required": ["snippet_id"]
                }
            ),
            
            # Commits
            types.Tool(
                name=TOOL_LIST_COMMITS,
                description=desc.DESC_LIST_COMMITS,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                        "ref_name": {"type": "string", "description": desc.DESC_REF.replace("commit SHA", "tag name")},
                        "since": {"type": "string", "description": desc.DESC_DATE_SINCE},
                        "until": {"type": "string", "description": desc.DESC_DATE_UNTIL},
                        "path": {"type": "string", "description": desc.DESC_PATH_FILTER},
                        "per_page": {"type": "integer", "description": desc.DESC_PER_PAGE, "default": DEFAULT_PAGE_SIZE, "minimum": 1, "maximum": MAX_PAGE_SIZE},
                        "page": {"type": "integer", "description": desc.DESC_PAGE_NUMBER, "default": 1, "minimum": 1}
                    }
                }
            ),
            types.Tool(
                name="gitlab_get_commit",
                description=desc.DESC_GET_COMMIT,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                        "commit_sha": {"type": "string", "description": desc.DESC_COMMIT_SHA},
                        "include_stats": {"type": "boolean", "description": desc.DESC_INCLUDE_STATS, "default": False}
                    },
                    "required": ["commit_sha"]
                }
            ),
            types.Tool(
                name="gitlab_get_commit_diff",
                description=desc.DESC_GET_COMMIT_DIFF,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                        "commit_sha": {"type": "string", "description": "Commit SHA"}
                    },
                    "required": ["commit_sha"]
                }
            ),
            
            # Search
            types.Tool(
                name="gitlab_search_projects",
                description=desc.DESC_SEARCH_PROJECTS,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "search": {"type": "string", "description": desc.DESC_SEARCH_TERM},
                        "per_page": {"type": "integer", "description": desc.DESC_PER_PAGE, "default": DEFAULT_PAGE_SIZE, "minimum": 1, "maximum": MAX_PAGE_SIZE},
                        "page": {"type": "integer", "description": desc.DESC_PAGE_NUMBER, "default": 1, "minimum": 1}
                    },
                    "required": ["search"]
                }
            ),
            types.Tool(
                name="gitlab_search_in_project",
                description=desc.DESC_SEARCH_IN_PROJECT,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                        "scope": {"type": "string", "description": desc.DESC_SEARCH_SCOPE, "enum": ["issues", "merge_requests", "milestones", "notes", "wiki_blobs", "commits", "blobs"]},
                        "search": {"type": "string", "description": desc.DESC_SEARCH_TERM},
                        "per_page": {"type": "integer", "description": desc.DESC_PER_PAGE, "default": DEFAULT_PAGE_SIZE, "minimum": 1, "maximum": MAX_PAGE_SIZE},
                        "page": {"type": "integer", "description": desc.DESC_PAGE_NUMBER, "default": 1, "minimum": 1}
                    },
                    "required": ["scope", "search"]
                }
            ),
            
            # Repository Info
            types.Tool(
                name=TOOL_LIST_BRANCHES,
                description=desc.DESC_LIST_BRANCHES,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": "Project ID or path (optional - auto-detects from git)"}
                    }
                }
            ),
            types.Tool(
                name=TOOL_LIST_PIPELINES,
                description=desc.DESC_LIST_PIPELINES,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                        "ref": {"type": "string", "description": desc.DESC_BRANCH_TAG_REF}
                    }
                }
            ),
            
            # User Events
            types.Tool(
                name=TOOL_LIST_USER_EVENTS,
                description=desc.DESC_LIST_USER_EVENTS,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "username": {"type": "string", "description": desc.DESC_USERNAME},
                        "action": {"type": "string", "description": desc.DESC_ACTION_FILTER, "enum": ["commented", "pushed", "created", "closed", "opened", "merged", "joined", "left", "destroyed", "expired", "removed", "deleted", "approved", "updated", "uploaded", "downloaded"]},
                        "target_type": {"type": "string", "description": desc.DESC_TARGET_TYPE_FILTER, "enum": ["Note", "Issue", "MergeRequest", "Commit", "Project", "Snippet", "User", "WikiPage", "Milestone", "Discussion", "DiffNote"]},
                        "per_page": {"type": "integer", "description": desc.DESC_PER_PAGE, "default": DEFAULT_PAGE_SIZE, "minimum": 1, "maximum": MAX_PAGE_SIZE},
                        "page": {"type": "integer", "description": desc.DESC_PAGE_NUMBER, "default": 1, "minimum": 1},
                        "after": {"type": "string", "description": desc.DESC_DATE_AFTER},
                        "before": {"type": "string", "description": desc.DESC_DATE_BEFORE}
                    },
                    "required": ["username"]
                }
            ),
            
            # MR Lifecycle Tools
            types.Tool(
                name="gitlab_update_merge_request",
                description=desc.DESC_UPDATE_MR,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                        "mr_iid": {"type": "integer", "description": desc.DESC_MR_IID},
                        "title": {"type": "string", "description": desc.DESC_TITLE},
                        "description": {"type": "string", "description": desc.DESC_DESCRIPTION},
                        "assignee_id": {"type": "integer", "description": desc.DESC_ASSIGNEE_ID},
                        "assignee_ids": {"type": "array", "items": {"type": "integer"}, "description": desc.DESC_ASSIGNEE_IDS},
                        "reviewer_ids": {"type": "array", "items": {"type": "integer"}, "description": desc.DESC_REVIEWER_IDS},
                        "labels": {"type": "string", "description": desc.DESC_LABELS},
                        "milestone_id": {"type": "integer", "description": desc.DESC_MILESTONE_ID},
                        "state_event": {"type": "string", "description": desc.DESC_STATE_EVENT, "enum": ["close", "reopen"]},
                        "remove_source_branch": {"type": "boolean", "description": desc.DESC_REMOVE_SOURCE_BRANCH},
                        "squash": {"type": "boolean", "description": desc.DESC_SQUASH},
                        "discussion_locked": {"type": "boolean", "description": desc.DESC_DISCUSSION_LOCKED},
                        "allow_collaboration": {"type": "boolean", "description": desc.DESC_ALLOW_COLLABORATION},
                        "target_branch": {"type": "string", "description": desc.DESC_TARGET_BRANCH}
                    },
                    "required": ["mr_iid"]
                }
            ),
            types.Tool(
                name="gitlab_close_merge_request",
                description=desc.DESC_CLOSE_MR,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                        "mr_iid": {"type": "integer", "description": desc.DESC_MR_IID}
                    },
                    "required": ["mr_iid"]
                }
            ),
            types.Tool(
                name="gitlab_merge_merge_request",
                description=desc.DESC_MERGE_MR,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                        "mr_iid": {"type": "integer", "description": desc.DESC_MR_IID},
                        "merge_when_pipeline_succeeds": {"type": "boolean", "description": desc.DESC_MERGE_WHEN_PIPELINE_SUCCEEDS, "default": False},
                        "should_remove_source_branch": {"type": "boolean", "description": desc.DESC_REMOVE_SOURCE_BRANCH},
                        "merge_commit_message": {"type": "string", "description": desc.DESC_MERGE_COMMIT_MESSAGE},
                        "squash_commit_message": {"type": "string", "description": desc.DESC_SQUASH_COMMIT_MESSAGE},
                        "squash": {"type": "boolean", "description": desc.DESC_SQUASH}
                    },
                    "required": ["mr_iid"]
                }
            ),
            
            # Comment Tools
            types.Tool(
                name="gitlab_add_issue_comment",
                description=desc.DESC_ADD_ISSUE_COMMENT,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                        "issue_iid": {"type": "integer", "description": desc.DESC_ISSUE_IID},
                        "body": {"type": "string", "description": desc.DESC_COMMENT_BODY}
                    },
                    "required": ["issue_iid", "body"]
                }
            ),
            types.Tool(
                name="gitlab_add_merge_request_comment",
                description=desc.DESC_ADD_MR_COMMENT,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                        "mr_iid": {"type": "integer", "description": desc.DESC_MR_IID},
                        "body": {"type": "string", "description": desc.DESC_COMMENT_BODY}
                    },
                    "required": ["mr_iid", "body"]
                }
            ),
            
            # Approval Tools
            types.Tool(
                name="gitlab_approve_merge_request",
                description=desc.DESC_APPROVE_MR,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                        "mr_iid": {"type": "integer", "description": desc.DESC_MR_IID}
                    },
                    "required": ["mr_iid"]
                }
            ),
            types.Tool(
                name="gitlab_get_merge_request_approvals",
                description=desc.DESC_GET_MR_APPROVALS,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                        "mr_iid": {"type": "integer", "description": desc.DESC_MR_IID}
                    },
                    "required": ["mr_iid"]
                }
            ),
            
            # Repository Tools
            types.Tool(
                name=TOOL_LIST_TAGS,
                description=desc.DESC_LIST_TAGS,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                        "order_by": {"type": "string", "description": desc.DESC_ORDER_BY_TAG, "enum": ["name", "updated", "version", "semver"], "default": "updated"},
                        "sort": {"type": "string", "description": desc.DESC_SORT_ORDER, "enum": ["asc", "desc"], "default": "desc"}
                    }
                }
            ),
            types.Tool(
                name="gitlab_create_commit",
                description=desc.DESC_CREATE_COMMIT,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                        "branch": {"type": "string", "description": desc.DESC_BRANCH},
                        "commit_message": {"type": "string", "description": desc.DESC_COMMIT_MESSAGE},
                        "actions": {
                            "type": "array",
                            "description": desc.DESC_ACTIONS,
                            "items": {
                                "type": "object",
                                "properties": {
                                    "action": {"type": "string", "enum": ["create", "update", "delete", "move"]},
                                    "file_path": {"type": "string"},
                                    "content": {"type": "string"},
                                    "previous_path": {"type": "string"},
                                    "encoding": {"type": "string", "enum": ["text", "base64"], "default": "text"}
                                },
                                "required": ["action", "file_path"]
                            }
                        },
                        "author_email": {"type": "string", "description": desc.DESC_AUTHOR_EMAIL},
                        "author_name": {"type": "string", "description": desc.DESC_AUTHOR_NAME}
                    },
                    "required": ["branch", "commit_message", "actions"]
                }
            ),
            types.Tool(
                name="gitlab_compare_refs",
                description=desc.DESC_COMPARE_REFS,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                        "from_ref": {"type": "string", "description": desc.DESC_FROM_REF},
                        "to_ref": {"type": "string", "description": desc.DESC_TO_REF},
                        "straight": {"type": "boolean", "description": desc.DESC_STRAIGHT, "default": False}
                    },
                    "required": ["from_ref", "to_ref"]
                }
            ),
            
            # Release and Member Tools
            types.Tool(
                name=TOOL_LIST_RELEASES,
                description=desc.DESC_LIST_RELEASES,
                inputSchema={
                    "type": "object",
                    "properties": {
                        "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                        "order_by": {"type": "string", "description": desc.DESC_ORDER_BY, "enum": ["released_at", "created_at"], "default": "released_at"},
                        "sort": {"type": "string", "description": desc.DESC_SORT_ORDER, "enum": ["asc", "desc"], "default": "desc"},
                        "per_page": {"type": "integer", "description": desc.DESC_PER_PAGE, "default": DEFAULT_PAGE_SIZE, "minimum": 1, "maximum": MAX_PAGE_SIZE},
                        "page": {"type": "integer", "description": desc.DESC_PAGE_NUMBER, "default": 1, "minimum": 1}
                    }
                }
            ),
            types.Tool(
  • Constant definition for the tool name string, used across handler registration, schema definitions, and server listings.
    TOOL_GET_USER_ACTIVITY_FEED = "gitlab_get_user_activity_feed"
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes the return format in detail (event details, timestamps, project context, etc.) and mentions pagination via per_page and page parameters, which adds useful context. However, it does not cover critical aspects like authentication requirements, rate limits, error handling, or whether it's read-only/destructive, leaving gaps in transparency for a tool with 8 parameters.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with sections for purpose, returns, use cases, parameters, and an example, making it easy to scan. It is appropriately sized for an 8-parameter tool, but some parts (like the detailed return list) could be slightly condensed without losing clarity, keeping it from a perfect score.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (8 parameters, no annotations, no output schema), the description is moderately complete. It covers purpose, returns, use cases, and parameters adequately, but lacks details on authentication, error handling, rate limits, and exact output structure, which are important for a retrieval tool with filtering options. This leaves room for improvement in contextual coverage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description adds value by clarifying parameter usage: it explains that 'user_id or username' can be used interchangeably, provides an example with specific values, and lists all parameters with brief context. This enhances understanding beyond the schema, though it doesn't add deep semantic details like enum values or complex constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Retrieve user's complete activity/events timeline') and resource ('user activities including commits, issues, MRs, comments, and other interactions across all accessible projects'). It distinguishes from siblings like gitlab_list_user_events by emphasizing 'complete activity/events timeline' with detailed return structure, making the purpose specific and well-differentiated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear use cases ('Track user engagement patterns', 'Monitor team member activities', etc.) that implicitly guide when to use this tool. However, it lacks explicit alternatives or exclusions, such as when to prefer gitlab_list_user_events or other sibling tools for simpler event listings, which prevents a perfect score.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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

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