> ## Documentation Index
> Fetch the complete documentation index at: https://docs.thena.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get workflow tasks

> MCP tool to retrieve tasks/activities within a workflow execution from the Thena platform.

import Admonition from '@theme/Admonition';

### MCP tool: `get_workflow_tasks`

Retrieves all tasks/activities within a specific workflow execution by its instance ID. This tool provides detailed information about individual workflow steps, their execution status, and results.

<Admonition type="note">
  You must provide the workflow instance ID to retrieve the tasks for that specific execution.
</Admonition>

### Example prompt

```prompt theme={null}
Get all tasks for workflow execution "EXECUTION001"
```

<Admonition type="info">
  When you use this prompt in a chat with the model (with the MCP tool registered), the model will automatically call the <code>get\_workflow\_tasks</code> tool with the correct arguments.
</Admonition>

### Input parameters

| Name               | Type   | Required | Description                               |
| ------------------ | ------ | -------- | ----------------------------------------- |
| workflowInstanceId | string | Yes      | The instance ID of the workflow execution |

### Response fields

Below are the fields you may see in each workflow task object in the response:

<table>
  <thead>
    <tr>
      <th>Field</th>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr><td>id</td><td>string</td><td>The identifier of the activity of a workflow instance</td></tr>
    <tr><td>stepIdentifier</td><td>number</td><td>The step identifier of the activity as present in workflow definition</td></tr>
    <tr><td>activity</td><td>string</td><td>The activity of the workflow instance</td></tr>
    <tr><td>status</td><td>string</td><td>The status of the activity of a workflow instance</td></tr>
    <tr><td>input</td><td>object</td><td>The input of the activity of a workflow instance</td></tr>
    <tr><td>result</td><td>object</td><td>The result of the activity of a workflow instance</td></tr>
    <tr><td>isRetry</td><td>boolean</td><td>If the activity is a retry</td></tr>
    <tr><td>isCompensation</td><td>boolean</td><td>If the activity is a compensation</td></tr>
    <tr><td>executionTime</td><td>number</td><td>The execution time of the activity (in seconds)</td></tr>
    <tr><td>startedAt</td><td>string (ISO8601)</td><td>The start date of the activity</td></tr>
    <tr><td>lastUpdatedAt</td><td>string (ISO8601)</td><td>The last updated date of the activity</td></tr>
  </tbody>
</table>

### Sample response

```json theme={null}
{
  "data": [
    {
      "id": "TASK001",
      "stepIdentifier": 1,
      "activity": "send-notification",
      "status": "COMPLETED",
      "input": {
        "recipients": ["support-team"],
        "message": "High priority ticket requires immediate attention",
        "priority": "urgent"
      },
      "result": {
        "notificationId": "NOTIF001",
        "sentTo": ["support-team"],
        "deliveryStatus": "delivered",
        "timestamp": "2025-07-24T10:00:15.000Z"
      },
      "isRetry": false,
      "isCompensation": false,
      "executionTime": 2.5,
      "startedAt": "2025-07-24T10:00:12.000Z",
      "lastUpdatedAt": "2025-07-24T10:00:15.000Z"
    },
    {
      "id": "TASK002",
      "stepIdentifier": 2,
      "activity": "assign-to-senior-agent",
      "status": "RUNNING",
      "input": {
        "priority": "high",
        "skillSet": ["escalation", "technical"],
        "autoAssign": true
      },
      "result": {
        "agentSearchInProgress": true,
        "candidatesFound": 3,
        "currentStep": "evaluating_availability"
      },
      "isRetry": false,
      "isCompensation": false,
      "executionTime": 45.2,
      "startedAt": "2025-07-24T10:00:16.000Z",
      "lastUpdatedAt": "2025-07-24T10:01:01.000Z"
    },
    {
      "id": "TASK003",
      "stepIdentifier": 2,
      "activity": "assign-to-senior-agent",
      "status": "FAILED",
      "input": {
        "priority": "high",
        "skillSet": ["escalation", "technical"],
        "autoAssign": true
      },
      "result": {
        "error": "No available agents with required skills",
        "attemptsMade": 3,
        "lastAttempt": "2025-07-24T10:01:30.000Z"
      },
      "isRetry": true,
      "isCompensation": false,
      "executionTime": 120.0,
      "startedAt": "2025-07-24T10:01:02.000Z",
      "lastUpdatedAt": "2025-07-24T10:03:02.000Z"
    },
    {
      "id": "TASK004",
      "stepIdentifier": 3,
      "activity": "update-ticket-status",
      "status": "PENDING",
      "input": {
        "status": "escalated",
        "comment": "Automatically escalated due to high priority"
      },
      "result": null,
      "isRetry": false,
      "isCompensation": false,
      "executionTime": 0,
      "startedAt": null,
      "lastUpdatedAt": "2025-07-24T10:00:16.000Z"
    }
  ],
  "status": true,
  "message": "Workflow tasks retrieved successfully!",
  "timestamp": "2025-07-25T12:50:38.937Z"
}
```

<Admonition type="tip">
  Always pass an object as input, even if empty, to avoid errors when calling the tool directly.
</Admonition>

***
