# journal_search

What was done on one machine, kept on it: tool calls with their arguments as kept and task starts and ends, by author, tool, task, time and text. No output.

**In short:** Risk class [`read`](https://docs.cmdop.ai/reference/tools.md#risk-classes). Over MCP call `journal_search`; over HTTP send `"tool": "journal_search"` 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 |
| --- | --- | --- | --- |
| `author` | `string` | no | Author or its start: `owner`, `agent:` (every agent), `agent:<name>`. A task's lines match through the `task_start` call that began it. |
| `kind` | `"call" | "task"` | no | Only calls or only task lines. Default: both. |
| `limit` | `integer` | no | At most this many lines, the newest (default 100, at most 500). |
| `since` | `integer` | no | At or after this time, unix seconds. |
| `task` | `integer` | no | Only the lines of this task (the server's task id). |
| `text` | `string` | no | Text, any case, in what this caller may see of a line: the tool, the outcome, the arguments, a task's command and folder. |
| `tool` | `string` | no | Only calls of this tool. |
| `until` | `integer` | no | Before this time, unix seconds. The next older page: the oldest line's `t` / 1000, plus 1 (lines of that second may repeat). |

## Result

| Name | Type | Required | Meaning |
| --- | --- | --- | --- |
| `events` | `any[]` | yes | Journal lines, oldest first; `t` is unix milliseconds. `call` lines: `tool`, `author`, `task`, `sealed`, `args` as the journal keeps them (paths, command lines and flags in clear, other values as length and hash), `outcome`, `ms`. `task` lines: `event` `start` (`pid`, `argv`, `cwd`) or `end` (`code`, `signal`), with the `author` of their `task_start` when it is still in the journal. `hidden` names what this caller may not see. |
| `more` | `boolean` | yes | The answer stopped at its limit or size: older matching lines may exist. |

## Examples

**MCP**

```json
{
  "name": "journal_search",
  "arguments": {
    "machine": "<machine>"
  }
}
```

**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":"journal_search","args":{}}'
```

## Limits

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