gitlab_get_file
Read a text file from a GitLab repository at a specified branch, tag, or commit to inspect source or configuration content, truncated to 500 lines.
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.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"file_path": "<file_path>",
"project_path": "<project_path>"
},
"name": "gitlab_get_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | No | Branch, tag or commit SHA. | master |
| file_path | Yes | Path to the file from the repo root (e.g. 'src/app.py'). | |
| project_path | Yes | GitLab project path (e.g. 'my-org/my-repo'). Required by default. For legacy deployments only, set GITLAB_ALLOW_DEFAULT_PROJECT=true to use GITLAB_PROJECT_PATH when omitted. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | Yes | ||
| size | Yes | ||
| content | Yes | ||
| file_path | Yes | ||
| truncated | Yes | ||
| total_lines | Yes |