## Tool: `fetch_batch_translation`

Retrieves a batch translation workflow's state and logs. If the state is not yet `SUCCEEDED` or `FAILED`, wait at least 10 seconds before rechecking the state. When it has finished, use `gcloud storage rsync` to download the outputs from `target_base_uri`, including translated files under `sql/` and the full log report at `report/translation_report.csv`. Review `translation_logs` and `report/translation_report.csv` for entries with severity `ERROR`, which indicate files where the translation failed or is best effort. `RelationNotFound` and `AttributeNotFound` mean the schema of a referenced table or column was missing. Provide a metadata .ZIP file generated with the BigQuery Migration Service metadata extractor or ask the user for one if none was supplied. You can also use `generate_batch_ddl_suggestion` when no metadata can be provided. For `SyntaxError`, `NoSuchFunction`, `UnsupportedFeatureError`, or `InternalError`, fix the invalid input or manually rewrite the unmapped functions and untranslated statements in the output. Then, validate with a BigQuery dry run.

The following code sample shows how to use `curl` to call the `fetch_batch_translation` MCP tool.

| Curl Request |
|---|
| ```bash curl --location 'https://bigquerymigration.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "fetch_batch_translation", "arguments": { // Provide these details according to the MCP tool specification. } }, "jsonrpc": "2.0", "id": 1 }' ``` |

## Input Schema

Request message for FetchBatchTranslation.

### FetchBatchTranslationRequest

| JSON representation |
|---|
| ``` { "projectNumber": string, "location": string, "translation": string } ``` |

| Fields ||
|---|---|
| `projectNumber` | `string` Required. The Google Cloud project number. |
| `location` | `string` Required. The location. |
| `translation` | `string` Required. The translation ID of the batch workflow. |

## Output Schema

Response message for FetchBatchTranslation.

### FetchBatchTranslationResponse

| JSON representation |
|---|
| ``` { "translation": { object (`https://docs.cloud.google.com/bigquery/docs/reference/migration/mcp/tools_list/fetch_batch_translation#Output.Schema.BatchTranslation`) }, "translationLogs": [ { object (`https://docs.cloud.google.com/bigquery/docs/reference/migration/mcp/tools_list/translate_query#Output.Schema.Log`) } ], "errorInfo": { object (`https://docs.cloud.google.com/bigquery/docs/reference/migration/mcp/tools_list/translate_query#Output.Schema.ErrorInfo`) } } ``` |

| Fields ||
|---|---|
| `translation` | ``object (`https://docs.cloud.google.com/bigquery/docs/reference/migration/mcp/tools_list/fetch_batch_translation#Output.Schema.BatchTranslation`)`` The batch translation resource. |
| `translationLogs[]` | ``object (`https://docs.cloud.google.com/bigquery/docs/reference/migration/mcp/tools_list/translate_query#Output.Schema.Log`)`` A summary list of logs generated during the batch translation process. The complete per-file log report is written to `report/translation_report.csv` under `target_base_uri`. Entries with severity `ERROR` mark files whose translation failed or is best effort. `effect` contains one of the following: `COMPLETENESS` means the schema of a referenced object was missing. This is detailed in the `metadata_file_paths` of `translate_batch_queries`. `CORRECTNESS` means the translator could not process part of the input. `COMPATIBILITY` means a feature was approximated for BigQuery. |
| `errorInfo` | ``object (`https://docs.cloud.google.com/bigquery/docs/reference/migration/mcp/tools_list/translate_query#Output.Schema.ErrorInfo`)`` The error information if the workflow itself failed to orchestrate. |

### BatchTranslation

| JSON representation |
|---|
| ``` { "translation": string, "state": string, "targetBaseUri": string } ``` |

| Fields ||
|---|---|
| `translation` | `string` The ID of the batch translation. |
| `state` | `string` The current state of the batch translation workflow, for example, `RUNNING`, `SUCCEEDED`, or `FAILED`. |
| `targetBaseUri` | `string` The base URI for all writes to persistent storage in Cloud Storage. This contains all of the generated translation outputs and artifacts. |

### Log

| JSON representation |
|---|
| ``` { "severity": string, "category": string, "message": string, "action": string, "effect": string, "impactedObject": string } ``` |

| Fields ||
|---|---|
| `severity` | `string` Severity of the translation record, for example, `INFO`, `WARNING`, or `ERROR`. |
| `category` | `string` Category of the error or warning, for example, `SyntaxError`. |
| `message` | `string` Detailed message of the record. |
| `action` | `string` Recommended action to address the log. |
| `effect` | `string` The effect or impact of the issue noted in the log. Effect can be one of the following values: `CORRECTNESS`: Errors with this effect indicate that the translation service couldn't meaningfully process the translation. This is caused by issues in the user's input such as incorrect language or formatting, or using an unsupported file type. `COMPLETENESS`: Errors with this effect indicate that the translation service doesn't have sufficient information to complete the translation. This can be caused by missing information in the user's input such as missing metadata for name resolution. `COMPATIBILITY`: Errors with this effect indicate that the translation service encountered compatibility issues when it processed the translation. This can happen when the target platform doesn't support a feature used in the input script, and the translation service tries to make a semantic approximation for the target platform. `NONE`: Errors with this effect are purely informational messages that have no effect on the output. Effects are ordered by their stage in the translation process. For example, `CORRECTNESS` issues are identified before `COMPLETENESS` issues. |
| `impactedObject` | `string` Name of the object that is impacted by the log message. |

### ErrorInfo

| JSON representation |
|---|
| ``` { "reason": string, "domain": string, "metadata": { string: string, ... } } ``` |

| Fields ||
|---|---|
| `reason` | `string` The reason for the error. This is a constant value that identifies the proximate cause of the error. Error reasons are unique within a particular domain of errors. This should be at most 63 characters and match a regular expression of `[A-Z][A-Z0-9_]+[A-Z0-9]`, which represents UPPER_SNAKE_CASE. |
| `domain` | `string` The logical grouping to which the "reason" belongs. The error domain is typically the registered service name of the tool or product that generates the error. Example: "pubsub.googleapis.com". If the error is generated by some common infrastructure, the error domain must be a globally unique value that identifies the infrastructure. For Google API infrastructure, the error domain is "googleapis.com". |
| `metadata` | `map (key: string, value: string)` Additional structured details about this error. Keys must match a regular expression of `[a-z][a-zA-Z0-9-_]+` but should ideally be lowerCamelCase. Also, they must be limited to 64 characters in length. When identifying the current value of an exceeded limit, the units should be contained in the key, not the value. For example, rather than `{"instanceLimit": "100/request"}`, should be returned as, `{"instanceLimitPerRequest": "100"}`, if the client exceeds the number of instances that can be created in a single (batch) request. An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |

### MetadataEntry

| JSON representation |
|---|
| ``` { "key": string, "value": string } ``` |

| Fields ||
|---|---|
| `key` | `string` |
| `value` | `string` |

### Tool Annotations


[Tool annotations](https://modelcontextprotocol.io/specification/latest/schema#toolannotations) 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: ❌