Tool: create_compilation_result
Create a new Dataform compilation result in a given Google Cloud project and location.
This tool compiles .sqlx files into executable SQL. Agents need to know that subsequent code changes aren't reflected in this result unless a new compilation is triggered.
The parent parameter value must be in the format projects/{project_id}/locations/{location}/repositories/{repository}.
Agents can validate the compiled SQL by inspecting CompilationResultAction resources and potentially using a BigQuery tool for a dry run.
A valid compilation result is required before triggering a manual workflow invocation using the create_workflow_invocation tool.
Prerequisite: Create a repository using the create_repository tool before calling the create_compilation_result tool.
The following sample demonstrate how to use curl to invoke the create_compilation_result 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": "create_compilation_result", "arguments": { // provide these details according to the tool's MCP specification } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
CreateCompilationResult request message.
CreateCompilationResultRequest
| JSON representation |
|---|
{
"parent": string,
"compilationResult": {
object ( |
| Fields | |
|---|---|
parent |
Required. The repository in which to create the compilation result. Must be in the format |
compilationResult |
Required. The compilation result to create. |
CompilationResult
| JSON representation |
|---|
{ "name": string, "codeCompilationConfig": { object ( |
| Fields | |
|---|---|
name |
Output only. The compilation result's name. |
codeCompilationConfig |
Immutable. If set, fields of |
resolvedGitCommitSha |
Output only. The fully resolved Git commit SHA of the code that was compiled. Not set for compilation results whose source is a workspace. |
dataformCoreVersion |
Output only. The version of |
compilationErrors[] |
Output only. Errors encountered during project compilation. |
dataEncryptionState |
Output only. Only set if the repository has a KMS Key. |
createTime |
Output only. The timestamp of when the compilation result was created. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
privateResourceMetadata |
Output only. Metadata indicating whether this resource is user-scoped. |
gcsRepositorySnapshotMetadata |
Output only. Metadata about the repository snapshot used by scheduled notebooks. |
Union field source. The source of the compilation result. source can be only one of the following: |
|
gitCommitish |
Immutable. Git commit/tag/branch name at which the repository should be compiled. Must exist in the remote repository. Examples: - a commit SHA: |
workspace |
Immutable. The name of the workspace to compile. Must be in the format |
releaseConfig |
Immutable. The name of the release config to compile. Must be in the format |
Union field
|
|
internalMetadata |
Output only. All the metadata information that is used internally to serve the resource. For example: timestamps, flags, status fields, etc. The format of this field is a JSON string. |
CodeCompilationConfig
| JSON representation |
|---|
{ "defaultDatabase": string, "defaultSchema": string, "defaultLocation": string, "assertionSchema": string, "vars": { string: string, ... }, "databaseSuffix": string, "schemaSuffix": string, "tablePrefix": string, "builtinAssertionNamePrefix": string, "defaultNotebookRuntimeOptions": { object ( |
| Fields | |
|---|---|
defaultDatabase |
Optional. The default database (Google Cloud project ID). |
defaultSchema |
Optional. The default schema (BigQuery dataset ID). |
defaultLocation |
Optional. The default BigQuery location to use. Defaults to "US". See the BigQuery docs for a full list of locations: https://cloud.google.com/bigquery/docs/locations. |
assertionSchema |
Optional. The default schema (BigQuery dataset ID) for assertions. |
vars |
Optional. User-defined variables that are made available to project code during compilation. An object containing a list of |
databaseSuffix |
Optional. The suffix that should be appended to all database (Google Cloud project ID) names. |
schemaSuffix |
Optional. The suffix that should be appended to all schema (BigQuery dataset ID) names. |
tablePrefix |
Optional. The prefix that should be prepended to all table names. |
builtinAssertionNamePrefix |
Optional. The prefix to prepend to built-in assertion names. |
defaultNotebookRuntimeOptions |
Optional. The default notebook runtime options. |
pipelineConfig |
Optional. The pipeline options which defines the pipeline type and path within the Git repository. |
VarsEntry
| JSON representation |
|---|
{ "key": string, "value": string } |
| Fields | |
|---|---|
key |
|
value |
|
NotebookRuntimeOptions
| JSON representation |
|---|
{ "aiPlatformNotebookRuntimeTemplate": string, // Union field |
| Fields | |
|---|---|
aiPlatformNotebookRuntimeTemplate |
Optional. The resource name of the Colab runtime template, from which a runtime is created for notebook executions. If not specified, a runtime is created with Colab's default specifications. |
Union field execution_sink. The location to store the notebook execution result. execution_sink can be only one of the following: |
|
gcsOutputBucket |
Optional. The Google Cloud Storage location to upload the result to. Format: |
Union field repository_snapshot_storage. The destination of the snapshot of repository files to be available for read-only access inside a notebook runtime repository_snapshot_storage can be only one of the following: |
|
gcsRepositorySnapshotDestination |
Optional. The Google Cloud Storage destination to upload the snapshot to. For empty URI it defaults to the provided gcs_output_bucket. Format: |
GcsRepositorySnapshotDestination
| JSON representation |
|---|
{ "repositorySnapshotUri": string } |
| Fields | |
|---|---|
repositorySnapshotUri |
Optional. The Google Cloud Storage destination to upload the repository snapshot to. Format: |
PipelineConfig
| JSON representation |
|---|
{
"pipelineType": enum ( |
| Fields | |
|---|---|
pipelineType |
Required. The type of the pipeline. |
path |
Required. The relative path within the Git repository where the pipeline is defined. For example, for a Dataform pipeline, it is a path to the folder where |
CompilationError
| JSON representation |
|---|
{
"message": string,
"stack": string,
"path": string,
"actionTarget": {
object ( |
| Fields | |
|---|---|
message |
Output only. The error's top level message. |
stack |
Output only. The error's full stack trace. |
path |
Output only. The path of the file where this error occurred, if available, relative to the project root. |
actionTarget |
Output only. The identifier of the action where this error occurred, if available. |
Target
| JSON representation |
|---|
{ "database": string, "schema": string, "name": string } |
| Fields | |
|---|---|
database |
Optional. The action's database (Google Cloud project ID) . |
schema |
Optional. The action's schema (BigQuery dataset ID), within |
name |
Optional. The action's name, within |
DataEncryptionState
| JSON representation |
|---|
{ "kmsKeyVersionName": string } |
| Fields | |
|---|---|
kmsKeyVersionName |
Required. The KMS key version name with which data of a resource is encrypted. |
Timestamp
| JSON representation |
|---|
{ "seconds": string, "nanos": integer } |
| Fields | |
|---|---|
seconds |
Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be between -62135596800 and 253402300799 inclusive (which corresponds to 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z). |
nanos |
Non-negative fractions of a second at nanosecond resolution. This field is the nanosecond portion of the duration, not an alternative to seconds. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be between 0 and 999,999,999 inclusive. |
PrivateResourceMetadata
| JSON representation |
|---|
{ "userScoped": boolean } |
| Fields | |
|---|---|
userScoped |
Output only. If true, this resource is user-scoped, meaning it is either a workspace or sourced from a workspace. |
GcsRepositorySnapshotMetadata
| JSON representation |
|---|
{ "repositorySnapshotUri": string, "crc32cChecksum": string, "generation": string } |
| Fields | |
|---|---|
repositorySnapshotUri |
Output only. The Google Cloud Storage URI of the repository snapshot. |
crc32cChecksum |
Output only. The crc32c checksum of the repository snapshot, big-endian base64 encoded. |
generation |
Output only. The generation number of the Cloud Storage object. See https://cloud.google.com/storage/docs/metadata#generation-number. |
PipelineType
The type of the pipeline. This may be extended in the future. In case of UNSPECIFIED, the error will be thrown.
| Enums | |
|---|---|
PIPELINE_TYPE_UNSPECIFIED |
Default value. This value is unused. |
DATAFORM |
Regular Dataform pipeline. |
SQL |
SQL single file asset. |
NOTEBOOK |
Notebook single file asset. |
Output Schema
Represents the result of compiling a Dataform project.
CompilationResult
| JSON representation |
|---|
{ "name": string, "codeCompilationConfig": { object ( |
| Fields | |
|---|---|
name |
Output only. The compilation result's name. |
codeCompilationConfig |
Immutable. If set, fields of |
resolvedGitCommitSha |
Output only. The fully resolved Git commit SHA of the code that was compiled. Not set for compilation results whose source is a workspace. |
dataformCoreVersion |
Output only. The version of |
compilationErrors[] |
Output only. Errors encountered during project compilation. |
dataEncryptionState |
Output only. Only set if the repository has a KMS Key. |
createTime |
Output only. The timestamp of when the compilation result was created. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
privateResourceMetadata |
Output only. Metadata indicating whether this resource is user-scoped. |
gcsRepositorySnapshotMetadata |
Output only. Metadata about the repository snapshot used by scheduled notebooks. |
Union field source. The source of the compilation result. source can be only one of the following: |
|
gitCommitish |
Immutable. Git commit/tag/branch name at which the repository should be compiled. Must exist in the remote repository. Examples: - a commit SHA: |
workspace |
Immutable. The name of the workspace to compile. Must be in the format |
releaseConfig |
Immutable. The name of the release config to compile. Must be in the format |
Union field
|
|
internalMetadata |
Output only. All the metadata information that is used internally to serve the resource. For example: timestamps, flags, status fields, etc. The format of this field is a JSON string. |
CodeCompilationConfig
| JSON representation |
|---|
{ "defaultDatabase": string, "defaultSchema": string, "defaultLocation": string, "assertionSchema": string, "vars": { string: string, ... }, "databaseSuffix": string, "schemaSuffix": string, "tablePrefix": string, "builtinAssertionNamePrefix": string, "defaultNotebookRuntimeOptions": { object ( |
| Fields | |
|---|---|
defaultDatabase |
Optional. The default database (Google Cloud project ID). |
defaultSchema |
Optional. The default schema (BigQuery dataset ID). |
defaultLocation |
Optional. The default BigQuery location to use. Defaults to "US". See the BigQuery docs for a full list of locations: https://cloud.google.com/bigquery/docs/locations. |
assertionSchema |
Optional. The default schema (BigQuery dataset ID) for assertions. |
vars |
Optional. User-defined variables that are made available to project code during compilation. An object containing a list of |
databaseSuffix |
Optional. The suffix that should be appended to all database (Google Cloud project ID) names. |
schemaSuffix |
Optional. The suffix that should be appended to all schema (BigQuery dataset ID) names. |
tablePrefix |
Optional. The prefix that should be prepended to all table names. |
builtinAssertionNamePrefix |
Optional. The prefix to prepend to built-in assertion names. |
defaultNotebookRuntimeOptions |
Optional. The default notebook runtime options. |
pipelineConfig |
Optional. The pipeline options which defines the pipeline type and path within the Git repository. |
VarsEntry
| JSON representation |
|---|
{ "key": string, "value": string } |
| Fields | |
|---|---|
key |
|
value |
|
NotebookRuntimeOptions
| JSON representation |
|---|
{ "aiPlatformNotebookRuntimeTemplate": string, // Union field |
| Fields | |
|---|---|
aiPlatformNotebookRuntimeTemplate |
Optional. The resource name of the Colab runtime template, from which a runtime is created for notebook executions. If not specified, a runtime is created with Colab's default specifications. |
Union field execution_sink. The location to store the notebook execution result. execution_sink can be only one of the following: |
|
gcsOutputBucket |
Optional. The Google Cloud Storage location to upload the result to. Format: |
Union field repository_snapshot_storage. The destination of the snapshot of repository files to be available for read-only access inside a notebook runtime repository_snapshot_storage can be only one of the following: |
|
gcsRepositorySnapshotDestination |
Optional. The Google Cloud Storage destination to upload the snapshot to. For empty URI it defaults to the provided gcs_output_bucket. Format: |
GcsRepositorySnapshotDestination
| JSON representation |
|---|
{ "repositorySnapshotUri": string } |
| Fields | |
|---|---|
repositorySnapshotUri |
Optional. The Google Cloud Storage destination to upload the repository snapshot to. Format: |
PipelineConfig
| JSON representation |
|---|
{
"pipelineType": enum ( |
| Fields | |
|---|---|
pipelineType |
Required. The type of the pipeline. |
path |
Required. The relative path within the Git repository where the pipeline is defined. For example, for a Dataform pipeline, it is a path to the folder where |
CompilationError
| JSON representation |
|---|
{
"message": string,
"stack": string,
"path": string,
"actionTarget": {
object ( |
| Fields | |
|---|---|
message |
Output only. The error's top level message. |
stack |
Output only. The error's full stack trace. |
path |
Output only. The path of the file where this error occurred, if available, relative to the project root. |
actionTarget |
Output only. The identifier of the action where this error occurred, if available. |
Target
| JSON representation |
|---|
{ "database": string, "schema": string, "name": string } |
| Fields | |
|---|---|
database |
Optional. The action's database (Google Cloud project ID) . |
schema |
Optional. The action's schema (BigQuery dataset ID), within |
name |
Optional. The action's name, within |
DataEncryptionState
| JSON representation |
|---|
{ "kmsKeyVersionName": string } |
| Fields | |
|---|---|
kmsKeyVersionName |
Required. The KMS key version name with which data of a resource is encrypted. |
Timestamp
| JSON representation |
|---|
{ "seconds": string, "nanos": integer } |
| Fields | |
|---|---|
seconds |
Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be between -62135596800 and 253402300799 inclusive (which corresponds to 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z). |
nanos |
Non-negative fractions of a second at nanosecond resolution. This field is the nanosecond portion of the duration, not an alternative to seconds. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be between 0 and 999,999,999 inclusive. |
PrivateResourceMetadata
| JSON representation |
|---|
{ "userScoped": boolean } |
| Fields | |
|---|---|
userScoped |
Output only. If true, this resource is user-scoped, meaning it is either a workspace or sourced from a workspace. |
GcsRepositorySnapshotMetadata
| JSON representation |
|---|
{ "repositorySnapshotUri": string, "crc32cChecksum": string, "generation": string } |
| Fields | |
|---|---|
repositorySnapshotUri |
Output only. The Google Cloud Storage URI of the repository snapshot. |
crc32cChecksum |
Output only. The crc32c checksum of the repository snapshot, big-endian base64 encoded. |
generation |
Output only. The generation number of the Cloud Storage object. See https://cloud.google.com/storage/docs/metadata#generation-number. |
PipelineType
The type of the pipeline. This may be extended in the future. In case of UNSPECIFIED, the error will be thrown.
| Enums | |
|---|---|
PIPELINE_TYPE_UNSPECIFIED |
Default value. This value is unused. |
DATAFORM |
Regular Dataform pipeline. |
SQL |
SQL single file asset. |
NOTEBOOK |
Notebook single file asset. |
Tool Annotations
Destructive Hint: ❌ | Idempotent Hint: ❌ | Read Only Hint: ❌ | Open World Hint: ❌