summaryrefslogtreecommitdiff
path: root/servers/gitlab_glab/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'servers/gitlab_glab/README.md')
-rw-r--r--servers/gitlab_glab/README.md78
1 files changed, 78 insertions, 0 deletions
diff --git a/servers/gitlab_glab/README.md b/servers/gitlab_glab/README.md
index 50926fb..cef74c2 100644
--- a/servers/gitlab_glab/README.md
+++ b/servers/gitlab_glab/README.md
@@ -6,6 +6,10 @@ This MCP server provides integration with GitLab through the GitLab CLI (`glab`)
- Check if the GitLab CLI is available and accessible
- Find GitLab projects by name and retrieve their IDs
+- Search for GitLab issues with various filters
+- Create new GitLab issues
+- Get merge request diffs with automatic handling of large diffs
+- Run CI/CD pipelines with support for variables and web mode
- More features to be added in the future
## Prerequisites
@@ -145,6 +149,80 @@ The function returns a dictionary containing:
- `url`: The URL of the created issue
- `error`: Error message if the operation failed
+### get_mr_diff
+
+Get the diff for a merge request using `glab mr diff` with optional content filtering.
+
+```python
+result = use_mcp_tool(
+ server_name="gitlab_glab",
+ tool_name="get_mr_diff",
+ arguments={
+ "working_directory": "/path/to/current/directory",
+ # Optional parameters
+ "mr_id": "123", # MR ID or branch name (if None, uses current branch)
+ "color": "never", # Use color in diff output: always, never, auto (default: never)
+ "raw": True, # Use raw diff format (default: False)
+ "repo": "group/project", # Project path with namespace
+ "max_size_kb": 100, # Maximum size in KB before saving to temp file (default: 100)
+ "filter_extensions": [".lock", ".log"] # File extensions to exclude from diff (default: [".lock", ".log"])
+ }
+)
+```
+
+The function returns a dictionary containing:
+
+- `diff`: The diff content (if small enough)
+- `size_kb`: The size of the diff in KB
+- `temp_file_path`: Path to temporary file if diff is too large (None otherwise)
+- `diff_too_large`: Boolean indicating if diff was saved to temp file
+- `max_size_kb`: The configured maximum size threshold
+- `message`: Human-readable message about temp file creation (if applicable)
+- `error`: Error message if the operation failed
+
+**Content Filtering**: By default, this tool filters out changes to files with `.lock` and `.log` extensions to reduce noise in diffs. This includes:
+
+- Lock files: `package-lock.json`, `yarn.lock`, `composer.lock`, etc.
+- Log files: `debug.log`, `error.log`, `application.log`, etc.
+
+You can customize the filtering by providing a `filter_extensions` list, or disable filtering entirely by passing an empty list `[]`.
+
+**Note on Large Diffs**: To prevent overwhelming LLMs with extremely large diffs, this tool automatically saves diffs larger than `max_size_kb` (default: 100KB) to a temporary file and returns the file path instead of the content. This allows you to process large merge request diffs without hitting token limits.
+
+### run_ci_pipeline
+
+Run a CI/CD pipeline on GitLab using `glab ci run`.
+
+```python
+result = use_mcp_tool(
+ server_name="gitlab_glab",
+ tool_name="run_ci_pipeline",
+ arguments={
+ "working_directory": "/path/to/current/directory",
+ # Optional parameters
+ "branch": "main", # Branch/ref to run pipeline on (if None, uses current branch)
+ "variables": ["VAR1:value1", "VAR2:value2"], # Variables in key:value format
+ "variables_env": ["ENV1:envval1"], # Environment variables in key:value format
+ "variables_file": ["FILE1:file1.txt"], # File variables in key:filename format
+ "variables_from": "/path/to/vars.json", # JSON file containing variables
+ "web_mode": True, # Enable web mode (sets CI_PIPELINE_SOURCE=web)
+ "repo": "group/project" # Project path with namespace
+ }
+)
+```
+
+The function returns a dictionary containing:
+- `success`: Boolean indicating if the pipeline was created successfully
+- `output`: The full command output from glab
+- `branch`: The branch the pipeline was created on
+- `web_mode`: Boolean indicating if web mode was used
+- `pipeline_url`: The URL of the created pipeline (if found in output)
+- `error`: Error message if the operation failed
+
+**Branch Detection**: If no `branch` is specified, the tool will automatically detect the current git branch using `git branch --show-current`. If branch detection fails, the pipeline will be created without specifying a branch (uses GitLab's default behavior).
+
+**Web Mode**: When `web_mode` is set to `True`, the tool adds `CI_PIPELINE_SOURCE:web` as an environment variable, which allows the pipeline to run with web-triggered behavior and access to manual pipeline features.
+
## Working Directory Context
All tools require a `working_directory` parameter that specifies the directory context in which the GitLab CLI commands should be executed. This ensures that commands are run in the same directory as the agent, maintaining proper context for repository operations.