Tool: read_repository_file
Return the contents of a file that's inside a Dataform repository.
This tool isn't for standard pipeline development. It's intended for direct repository interaction, typically for managing single-file assets such as notebooks or saved queries.
Don't use this tool on repositories connected to a remote Git host. To verify, use the get_repository tool. If the git_remote_settings field is present, the repository is connected to a remote host and you must use the read_file tool to read the file from a workspace instead.
The name parameter value refers to the repository and must be in the format projects/{project_id}/locations/{location}/repositories/{repository}.
The path parameter value must be relative to the repository root. Don't use directory traversal, such as ... Use the query_repository_directory_contents tool to obtain valid file paths.
The following code sample shows how to use curl to call the read_repository_file MCP tool.
| Curl Request |
|---|
curl --location 'https://dataform.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "read_repository_file", "arguments": { // Provide these details according to the MCP tool specification. } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
ReadRepositoryFile request message.
ReadRepositoryFileRequest
| JSON representation |
|---|
{ "name": string, "commitSha": string, "path": string } |
| Fields | |
|---|---|
name |
Required. The repository's name. |
commitSha |
Optional. The commit SHA for the commit to read from. If unset, the file will be read from HEAD. |
path |
Required. Full file path to read including filename, from repository root. |
Output Schema
ReadRepositoryFile response message.
ReadRepositoryFileResponse
| JSON representation |
|---|
{ "contents": string } |
| Fields | |
|---|---|
contents |
The file's contents. A base64-encoded string. |
Tool Annotations
Tool annotations are sent to MCP clients to describe the basic risk of a given tool. Most clients treat these hints as untrusted, but they can be used to decide when a confirmation prompt might be sent to a user.
Along with the title string, the following boolean hints are defined as follows:
readOnlyHint: If true, the tool doesn't modify its environment. Default: false.destructiveHint: If true, then the tool can perform destructive actions. If false, then the tool can only perform additive actions. Default: true.idempotentHint: If true, then calling the tool repeatedly with the same arguments will have no additional effect on its environment. Default: false.openWorldHint: If true, then the tool can interact with an 'open world' of external entities. If false, then the tool can only interact with internal entities. For example, a web search tool would be open world, while a memory tool would not be open world.
Destructive Hint: ❌ | Idempotent Hint: ✅ | Read Only Hint: ✅ | Open World Hint: ❌