Gitlab Get File
gitlab_get_fileFetch file content from a GitLab repository by project ID and file path (e.g., "src/main.py"). Returns decoded content, file size, name, and encoding.
Example tool call
This call uses example arguments supplied in the tool’s input schema.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"_apiKey": "your-gitlab-api-key",
"file_path": "README.md",
"project_id": "123"
},
"name": "gitlab_get_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | No | Branch, tag, or commit SHA (default: default branch) | |
| _apiKey | Yes | GitLab personal access token | |
| file_path | Yes | Path to the file within the repository | |
| project_id | Yes | Project ID (numeric) or full path "namespace/project" (e.g. "gitlab-org/gitlab"), pass the plain path, do not URL-encode it. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | Yes | Git ref (branch/tag/commit) | |
| size | Yes | File size in bytes | |
| content | Yes | Decoded file content | |
| file_name | Yes | File name | |
| file_path | Yes | File path in repository | |
| last_commit | Yes | Last commit SHA |