Tool: get_task_instance
Retrieves details of a specific task instance from a Cloud Composer environment.
Use this tool to retrieve details of a specific task instance, such as its state, start time, end time, or parameters, to understand its status or to debug a failure.
This tool does not return task instance logs directly. Instead, use the cloud_logging_filter field from the response to query Cloud Logging for the logs for this task instance.
The following sample demonstrate how to use curl to invoke the get_task_instance MCP tool.
| Curl Request |
|---|
curl --location 'https://composer.{region}.rep.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "get_task_instance", "arguments": { // provide these details according to the tool's MCP specification } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
Parameters of the get_task_instance tool.
GetTaskInstanceRequestMCP
| JSON representation |
|---|
{ "environment": string, "dagId": string, "dagRunId": string, "taskId": string, // Union field |
| Fields | |
|---|---|
environment |
Required. The name of the environment. Format: |
dagId |
Required. The Airflow DAG ID. |
dagRunId |
Required. The Airflow DAG run ID. |
taskId |
Required. The Airflow task ID. |
Union field
|
|
mapIndex |
Optional. For mapped tasks, the map index of the task. It should not be populated for non-mapped tasks. |
Output Schema
Task instance in a DAG run.
TaskInstance
| JSON representation |
|---|
{
"name": string,
"id": string,
"taskId": string,
"dagRunId": string,
"dagId": string,
"taskType": string,
"executionDate": string,
"startDate": string,
"endDate": string,
"runAfter": string,
"state": enum ( |
| Fields | |
|---|---|
name |
Required. The resource name of the task instance, in the form: "projects/{project_id}/locations/{location_id}/environments/{environment_id}/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_instance_id_with_optional_map_index}". |
id |
The task instance ID. It is the same as the task ID of a DAG. |
taskId |
The task instance ID. It is the same as the task ID in the DAG. |
dagRunId |
The DAG run ID the task instance belongs to. |
dagId |
The DAG ID of the DAG whose execution is described by the DAG run the taskInstance belongs to. |
taskType |
The operator used in this task. |
executionDate |
Execution date for the task. 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: |
startDate |
Timestamp when the task instance started execution. 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: |
endDate |
Timestamp when the task instance finished execution. 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: |
runAfter |
Timestamp when the parent DAG run was scheduled to start. Added in Airflow 3. 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: |
state |
Task instance state. |
tryNumber |
The try number that this task number will be when it is actually run. |
hostname |
Hostname of the machine or pod the task runs on. |
queuedDttm |
Timestamp when the task was queued. 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: |
pool |
The slot pool this task runs in. |
queue |
Which queue to target when running this task. |
priorityWeight |
Priority weight of this task against other tasks. |
maxTries |
The number of tries that should be performed before failing the task. |
isDynamicallyMapped |
Whether this TaskInstance is dynamically mapped. |
mapIndex |
If is_dynamically_mapped is set to true, this field contains index of the dynamically-mapped TaskInstance, If is_dynamically_mapped is set to false, this field has no meaning. |
externalExecutorId |
ID of the external executor. |
renderedMapIndex |
Named mapping - a rendered map index template for this task instance. If task doesn't have a template specified or is_dynamically_mapped is set to false, this field is empty. |
note |
The note content of the task instance. Added in Airflow 2.10.0. |
cloudLoggingFilter |
A Cloud Logging filter that can be used to retrieve the logs of this task instance. |
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. |
Tool Annotations
Destructive Hint: ❌ | Idempotent Hint: ✅ | Read Only Hint: ✅ | Open World Hint: ❌