<!-- Generated by crates/swarmops-cli/src/reference/mcp_page.rs from the code: do not edit. Change the code, then run SWARMOPS_REGEN_REFERENCE=1 with the regen_reference test. -->

# verify

Checks the whole store's consistency; deep re-hashes every object and checks the derived values against the objects too.

```yaml
title: "verify"
description: "Verify the store."
since: "0.1.0"
mutates: false
identity_required: false
cli_command: "swarmops verify"
envelope_op: "verify"
request_type: "VerifyReq"
annotations: {"destructiveHint":false,"idempotentHint":true,"openWorldHint":false,"readOnlyHint":true}
max_result_chars: null
```

## Input schema

`arguments` is a `VerifyReq`: `swarmops schema VerifyReq` prints the type. A field the type does not know is ignored.

| Field | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `deep` | boolean | no | `false` | Re-hash every object, and check every derived value of the built-in derivations (the first-parent skip lists, the last touches of paths) against the objects. When `false`, verify checks structure only: parents, that referenced objects exist, the index against the journal, and refs. |

### JSON Schema

As `tools/list` gives it: each `$ref` replaced by its definition, so that it stands alone.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "`verify`: check the whole store's consistency.",
  "properties": {
    "deep": {
      "default": false,
      "description": "Re-hash every object, and check every derived value of the built-in derivations (the\nfirst-parent skip lists, the last touches of paths) against the objects. When `false`,\nverify checks structure only: parents, that referenced objects exist, the index against\nthe journal, and refs.",
      "type": "boolean"
    }
  },
  "title": "VerifyReq",
  "type": "object"
}
```

## Annotations

It only reads the store.

| Annotation | Value | Meaning |
| --- | --- | --- |
| `destructiveHint` | `false` | True: a tool that changes the store may overwrite or delete what is there, not only add to it. |
| `idempotentHint` | `true` | True: calling it again with the same arguments changes nothing more. |
| `openWorldHint` | `false` | True: it reaches beyond a closed set of things. Every tool here stays inside the store. |
| `readOnlyHint` | `true` | True: the tool does not change its environment, the store. |

Its entry in `tools/list` carries no `_meta`.

## CLI command

[`swarmops verify`](../commands/verify.md) runs the same operation and prints the same envelope.

## Examples

### MCP

```json
{
  "id": 22,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "verify"
  }
}
```

```json
{
  "id": 22,
  "jsonrpc": "2.0",
  "result": {
    "content": [
      {
        "text": "{\"ok\":true,\"op\":\"verify\",\"api\":1,\"result\":{\"objects_checked\":14,\"changesets_checked\":4,\"problems\":[],\"findings\":[]},\"meta\":{\"repo\":\"[tmp]/store\",\"elapsed_ms\":\"[elapsed_ms]\",\"resolved\":{},\"auth\":\"trust\"}}",
        "type": "text"
      }
    ],
    "isError": false,
    "structuredContent": {
      "api": 1,
      "meta": {
        "auth": "trust",
        "elapsed_ms": "[elapsed_ms]",
        "repo": "[tmp]/store",
        "resolved": {}
      },
      "ok": true,
      "op": "verify",
      "result": {
        "changesets_checked": 4,
        "findings": [],
        "objects_checked": 14,
        "problems": []
      }
    }
  }
}
```

The server ran as `swarmops mcp --repo [tmp]/store --as agent/worker-17`, after `initialize`. Recorded by the MCP tests. A name in square brackets, such as `[tmp]` or `[c1]`, stands for what differs from run to run: the test's temporary directory, an id, a time, the version.

## Details

Without `deep`, it checks structure: parents, that referenced objects exist, the index against
the journal, and refs.
With `deep: true` it also re-hashes every object and checks the derived values against the
objects.
A store with problems is `E_STORE_CORRUPT`, as `swarmops verify` is.

## Return information

A tool result: the envelope, whose `op` is `verify`, as `structuredContent` and again as the text of its one `content` block. `isError` is true exactly when the envelope's `ok` is false. On success the envelope's `result` is what [`swarmops verify`](../commands/verify.md#return-information) returns.

## Errors

A failed call is a tool result with `isError: true`; the envelope's `error.code` is one of the [error codes](../errors.md).

- [`E_INVALID_ARG`](../errors.md#e_invalid_arg): arguments that do not fit `VerifyReq`, a field named twice among them included, or that break one of the server's own rules.
- [`E_STORE_CORRUPT`](../errors.md#e_store_corrupt): the store has problems, as `swarmops verify` reports them.
- [`E_NOT_A_REPO`](../errors.md#e_not_a_repo): the server's store is not there; the server serves on.
- [`E_INTERNAL`](../errors.md#e_internal): the operation panicked, a bug.

Then the errors of the operation, as [`swarmops verify`](../commands/verify.md#errors) lists them.

## See also

- [`swarmops verify`](../commands/verify.md)
- [MCP tools](README.md)
- [MCP integration](../../develop/mcp.md)
- [Error codes](../errors.md)
