gitlab_get_file

Pack: gitlab · Endpoint: https://gateway.pipeworx.io/gitlab/mcp

Fetch 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.

Parameters

NameTypeRequiredDescription
_apiKeystringyesGitLab personal access token
project_idstringyesProject ID or URL-encoded path
file_pathstringyesPath to the file within the repository
refstringnoBranch, tag, or commit SHA (default: default branch)

Example call

Arguments

{
  "_apiKey": "your-gitlab-api-key",
  "project_id": "123",
  "file_path": "README.md"
}

curl

curl -X POST https://gateway.pipeworx.io/gitlab/mcp \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"gitlab_get_file","arguments":{"_apiKey":"your-gitlab-api-key","project_id":"123","file_path":"README.md"}}}'

TypeScript (@pipeworx/sdk)

import { Pipeworx } from '@pipeworx/sdk';
const pipeworx = new Pipeworx();

const result = await pipeworx.call('gitlab_get_file', {
  "_apiKey": "your-gitlab-api-key",
  "project_id": "123",
  "file_path": "README.md"
});

More examples

{
  "_apiKey": "your-gitlab-api-key",
  "project_id": "123",
  "file_path": "src/main.py",
  "ref": "develop"
}

Response shape

Always returns: file_name, file_path, size, ref, last_commit, content

FieldTypeDescription
file_namestringFile name
file_pathstringFile path in repository
sizenumberFile size in bytes
refstringGit ref (branch/tag/commit)
last_commitstringLast commit SHA
contentstringDecoded file content
Full JSON Schema
{
  "type": "object",
  "properties": {
    "file_name": {
      "type": "string",
      "description": "File name"
    },
    "file_path": {
      "type": "string",
      "description": "File path in repository"
    },
    "size": {
      "type": "number",
      "description": "File size in bytes"
    },
    "ref": {
      "type": "string",
      "description": "Git ref (branch/tag/commit)"
    },
    "last_commit": {
      "type": "string",
      "description": "Last commit SHA"
    },
    "content": {
      "type": "string",
      "description": "Decoded file content"
    }
  },
  "required": [
    "file_name",
    "file_path",
    "size",
    "ref",
    "last_commit",
    "content"
  ]
}

Connect

Add this to your MCP client config, or use one-click install buttons:

{
  "mcpServers": {
    "gitlab": {
      "url": "https://gateway.pipeworx.io/gitlab/mcp"
    }
  }
}

See Getting Started for client-specific install steps.

Regenerated from source · build May 9, 2026