gitlab_get_file
Retrieve text files from GitLab repositories to examine configuration files, source code, or documentation. Specify file path and branch/tag to access content directly.
Instructions
Read a text file from the repository, truncated to 500 lines.
For binaries, gets decoded as UTF-8 with errors replaced — you will likely get garbage; use for text content only.
Examples:
- "Show me .gitlab-ci.yml on master" → file_path='.gitlab-ci.yml'
- "Read src/app.py from the release-1.2 tag" → file_path='src/app.py', ref='release-1.2'
- Don't use for listings — use gitlab_list_repository_tree.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | Path to the file from the repo root (e.g. 'src/app.py'). | |
| ref | No | Branch, tag or commit SHA. | master |
| project_path | No | GitLab project path (e.g. 'my-org/my-repo'). When omitted, the default from GITLAB_PROJECT_PATH env var is used. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | ||
| ref | Yes | ||
| size | Yes | ||
| total_lines | Yes | ||
| truncated | Yes | ||
| content | Yes |