# get\_last\_turns

Read the newest turns of an agent's transcript.

read-only · idempotent · MCP tool · [Agent](https://komrad.dev/latest/api/agent.md)

A long turn is cut from its start to fit [`max_bytes`](https://komrad.dev/latest/api/agent/get-last-turns.md#komrad-agent-v1-GetLastTurnsRequest-max_bytes).

## Calling it

```bash
curl -X POST http://127.0.0.1:8787/komrad.agent.v1.AgentService/GetLastTurns \
  -H 'Content-Type: application/json' \
  -d '{
  "agent_id": "<agent_id>"
}'
```

```bash
komrad rpc get-last-turns \
  --agent-id '<uuid>'
```

```json
{
  "name": "get_last_turns",
  "arguments": {
    "agent_id": "<agent_id>"
  }
}
```

Offered by the komrad MCP server to writer, reviewer, orchestrator agents.

## Request

### GetLastTurnsRequest

| Field | Type | Description |
| --- | --- | --- |
| [`agent_id`](https://komrad.dev/latest/api/agent/get-last-turns.md#komrad-agent-v1-GetLastTurnsRequest-agent_id) | uuid\* | The agent whose transcript to read, by id. |
| [`turns`](https://komrad.dev/latest/api/agent/get-last-turns.md#komrad-agent-v1-GetLastTurnsRequest-turns) | int32 between 1 and 20 | How many of the newest agent turns to return, with the prompts between them. Unset returns the last turn only. |
| [`max_bytes`](https://komrad.dev/latest/api/agent/get-last-turns.md#komrad-agent-v1-GetLastTurnsRequest-max_bytes) | int32 at least 0 | The most bytes to return for each turn. A longer turn loses its start, so its end stays. Unset uses the default. |

## Response

### GetLastTurnsResponse

| Field | Type | Description |
| --- | --- | --- |
| [`turns`](https://komrad.dev/latest/api/agent/get-last-turns.md#komrad-agent-v1-GetLastTurnsResponse-turns) | [Turn\[\]](https://komrad.dev/latest/api/agent/get-last-turns.md#komrad-agent-v1-Turn) | The newest agent turns and the prompts between them, oldest first. |

## Types

### Turn

Turn is one turn of an agent's transcript.

| Field | Type | Description |
| --- | --- | --- |
| [`role`](https://komrad.dev/latest/api/agent/get-last-turns.md#komrad-agent-v1-Turn-role) | string | Who wrote the turn: the agent, or whoever prompted it. |
| [`seq`](https://komrad.dev/latest/api/agent/get-last-turns.md#komrad-agent-v1-Turn-seq) | int32 | The turn's position in the transcript, counting from zero. |
| [`content`](https://komrad.dev/latest/api/agent/get-last-turns.md#komrad-agent-v1-Turn-content) | string | The turn's text. When [`truncated`](https://komrad.dev/latest/api/agent/get-last-turns.md#komrad-agent-v1-Turn-truncated) is set, only the end of it. |
| [`truncated`](https://komrad.dev/latest/api/agent/get-last-turns.md#komrad-agent-v1-Turn-truncated) | bool | Whether the start of the text was cut to fit `max_bytes`. |
