# read\_logs

Read the lines komrad or the CLIs wrote about one agent, one of its hook runs' output, or the log of a language server over its task's checkout.

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

Pass the returned [`cursor`](https://komrad.dev/latest/api/log/read-logs.md#komrad-log-v1-ReadLogsRequest-cursor) back to read only new lines.

## Calling it

```bash
curl -X POST http://127.0.0.1:8787/komrad.log.v1.LogService/ReadLogs \
  -H 'Content-Type: application/json' \
  -d '{
  "agent_id": "<agent_id>",
  "service": "<service>"
}'
```

```bash
komrad rpc read-logs \
  --agent-id '<uuid>' \
  --service '<ServiceLog>'
```

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

Offered by the komrad MCP server to orchestrator agents.

## Request

### ReadLogsRequest

| Field | Type | Description |
| --- | --- | --- |
| [`agent_id`](https://komrad.dev/latest/api/log/read-logs.md#komrad-log-v1-ReadLogsRequest-agent_id) | uuid\* | The agent whose lines to read, by id. |
| [one of](https://komrad.dev/latest/api/log/read-logs.md#komrad-log-v1-ReadLogsRequest-log)\* |  | The log to read. |
| [`service`](https://komrad.dev/latest/api/log/read-logs.md#komrad-log-v1-ReadLogsRequest-service) | [ServiceLog](https://komrad.dev/latest/api/log/read-logs.md#komrad-log-v1-ServiceLog) | Which lines of the server log to read. |
| [`hook_run_id`](https://komrad.dev/latest/api/log/read-logs.md#komrad-log-v1-ReadLogsRequest-hook_run_id) | uuid | The hook run whose output to read, by the id [`list_log_sources`](https://komrad.dev/latest/api/log/list-log-sources.md) returns. The hook run must be one of the agent's. |
| [`language_server`](https://komrad.dev/latest/api/log/read-logs.md#komrad-log-v1-ReadLogsRequest-language_server) | string not empty | The language server whose log to read, by the name [`list_log_sources`](https://komrad.dev/latest/api/log/list-log-sources.md) returns. |
| [`cursor`](https://komrad.dev/latest/api/log/read-logs.md#komrad-log-v1-ReadLogsRequest-cursor) | string | The [`cursor`](https://komrad.dev/latest/api/log/read-logs.md#komrad-log-v1-ReadLogsRequest-cursor) from the previous response. Empty reads the newest lines. |
| [`limit`](https://komrad.dev/latest/api/log/read-logs.md#komrad-log-v1-ReadLogsRequest-limit) | int32 between 0 and 1000 | The most lines to return. Zero returns up to 200. |
| [`pattern`](https://komrad.dev/latest/api/log/read-logs.md#komrad-log-v1-ReadLogsRequest-pattern) | string at most 256 characters | A Go regular expression each line must match. Empty matches every line. Only the last 64 MB of the log is searched. |

## Response

### ReadLogsResponse

| Field | Type | Description |
| --- | --- | --- |
| [`lines`](https://komrad.dev/latest/api/log/read-logs.md#komrad-log-v1-ReadLogsResponse-lines) | [AgentLogLine\[\]](https://komrad.dev/latest/api/log/read-logs.md#komrad-log-v1-AgentLogLine) | The lines, oldest first, as the log wrote them. |
| [`cursor`](https://komrad.dev/latest/api/log/read-logs.md#komrad-log-v1-ReadLogsResponse-cursor) | string | The cursor to pass back to read only lines written after these. |
| [`reset`](https://komrad.dev/latest/api/log/read-logs.md#komrad-log-v1-ReadLogsResponse-reset) | bool | Whether the log started over since the cursor. The lines before the reset are gone. |
| [`more`](https://komrad.dev/latest/api/log/read-logs.md#komrad-log-v1-ReadLogsResponse-more) | bool | Whether more lines remain past the cursor, which another call returns at once. |

## Types

### AgentLogLine

AgentLogLine is one line of an agent's log.

| Field | Type | Description |
| --- | --- | --- |
| [`text`](https://komrad.dev/latest/api/log/read-logs.md#komrad-log-v1-AgentLogLine-text) | string | The line, exactly as the log holds it. |

### ServiceLog

ServiceLog is which lines of the server log to read.

| Value | Description |
| --- | --- |
| [`SERVICE_LOG_KOMRAD`](https://komrad.dev/latest/api/log/read-logs.md#komrad-log-v1-ServiceLog-SERVICE_LOG_KOMRAD) | Komrad's own lines. |
| [`SERVICE_LOG_CLI`](https://komrad.dev/latest/api/log/read-logs.md#komrad-log-v1-ServiceLog-SERVICE_LOG_CLI) | The records the agents' CLIs sent. |
