get_file_at_ref
Read file content at a specific git ref.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
repo |
string | Yes | Repository path. Format: teams/team_slug/repo_slug or username/repo_slug. |
path |
string | Yes | Path to the file within the repository. |
ref |
string | No | Git ref (branch, tag, or commit SHA) to read from. Default: HEAD. |
Example
curl -X POST https://ghit.example/api/v1/mcp \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get_file_at_ref",
"arguments": {
"repo": "teams/acme/webapp",
"path": "src/main.rs",
"ref": "main"
}
}
}'
Response
Returns the file content as a text content block inside the standard MCP tool result. Returns an error if the file does not exist at the given ref.