# task_output

A task's screen as text, whether it runs. The last 200 lines by default; the machine keeps 1000 lines of its last 50 tasks until it restarts. What ran: journal_search.

**In short:** Risk class [`read`](https://docs.cmdop.ai/reference/tools.md#risk-classes). Over MCP call `task_output`; over HTTP send `"tool": "task_output"` to [`POST /api/v1/call`](https://docs.cmdop.ai/reference/http/post-call.md).

## Arguments

Over MCP every tool also takes `machine`: the machine's name or id, optional when only one machine is online.

| Name | Type | Required | Meaning |
| --- | --- | --- | --- |
| `lines` | `integer` | no | Return only the last this many lines (default 200, 0 for all the machine keeps). |
| `task` | `integer` | yes | Task id, as task_start or tasks_list returned it. |

## Result

| Name | Type | Required | Meaning |
| --- | --- | --- | --- |
| `running` | `boolean` | yes | False once the task has ended. |
| `task` | `integer` | yes |  |
| `text` | `string` | yes | The terminal's screen and recent scrollback as text, terminal codes applied. |

## Examples

**MCP**

```json
{
  "name": "task_output",
  "arguments": {
    "machine": "<machine>",
    "task": 0
  }
}
```

**HTTP**

```bash
curl -sS -X POST "https://<contour>.cmdop.ai/api/v1/call" \
  -H "Authorization: Bearer $CMDOP_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"machine":"<machine>","tool":"task_output","args":{"task":0}}'
```

## Limits

The call times out after 10 s (`timed_out`). Available since version 0.0.1. A refused or failed call returns one of the [error codes](https://docs.cmdop.ai/reference/errors.md).
