# check_lint

> Release: 0.13.0 · Last changed: 2026-11-30 · Source: https://github.com/KeiaiLab/SwarmOps/blob/stable/docs/reference/mcp-tools/check-lint.md

Reports what the checks of the tree of rev, main by default, name that cannot work, without running any: a need that is no check of the file or not of every stage of the check that names it, an input pattern that matches no path of the tree, and a dir that is no directory of it. With none the result says how many checks it looked at; with one it is E\_CHECK\_FILE (details.reason lint) whose details.lint holds every fault with its key, value and line, ordered by check, kind and value, at most 1,000 of them. Reads only. A file that does not read is E\_CHECK\_FILE too, with its line and key.

```yaml
title: "check_lint"
description: "Lint a tree's checks."
since: "0.1.0"
mutates: false
identity_required: false
cli_command: "swarmops check lint"
envelope_op: "check_lint"
request_type: "CheckLintReq"
annotations: {"destructiveHint":false,"idempotentHint":true,"openWorldHint":false,"readOnlyHint":true}
max_result_chars: null
```

## Input schema

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

| Field | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `rev` | string | no | `"main"` | The changeset whose tree's checks to lint; `main` when omitted. A revision as the caller wrote it, for the store to resolve: a ref name (`main`, `release/1.2`), a full 64-hex changeset id or a unique prefix of at least 12 hex digits, or a ref's earlier value: `<ref>@{N}` the value it held N moves before its current one (`@{0}` is the current value), `<ref>@{at=<unix seconds>}` the value set by its newest move recorded at or before that instant (the writer's clock, moves read in journal order); optionally followed by `~N` for the N-th first-parent ancestor. |

### 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": "`check_lint` (CLI `check lint`): the definitions of the tree of `rev` that cannot work. It\nreads the check file as `check list` reads it, and looks at what each check names: the checks\nit needs, the paths it reads and the directory it runs in. Reads only: no lock, no identity,\nnothing written, nothing run.",
  "properties": {
    "rev": {
      "default": "main",
      "description": "The changeset whose tree's checks to lint; `main` when omitted. A revision as the caller wrote it, for the store to resolve: a ref name (`main`,\n`release/1.2`), a full 64-hex changeset id or a unique prefix of at least 12 hex digits, or a\nref's earlier value: `<ref>@{N}` the value it held N moves before its current one (`@{0}`\nis the current value), `<ref>@{at=<unix seconds>}` the value set by its newest move\nrecorded at or before that instant (the writer's clock, moves read in journal order);\noptionally followed by `~N` for the N-th first-parent ancestor.",
      "type": "string"
    }
  },
  "title": "CheckLintReq",
  "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 check lint`](../commands/check-lint.md) runs the same operation and prints the same envelope.

## Examples

### MCP

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

```json
{
  "id": 49,
  "jsonrpc": "2.0",
  "result": {
    "content": [
      {
        "text": "{\"api\":1,\"meta\":{\"auth\":\"trust\",\"elapsed_ms\":\"[elapsed_ms]\",\"repo\":\"[tmp]/store\",\"resolved\":{\"[grouped]\":\"[grouped]\",\"main\":\"[grouped]\"}},\"ok\":true,\"op\":\"check_lint\",\"result\":{\"checks\":0,\"faults\":[],\"tree\":\"[id20]\",\"vouched\":false}}",
        "type": "text"
      }
    ],
    "isError": false,
    "structuredContent": {
      "api": 1,
      "meta": {
        "auth": "trust",
        "elapsed_ms": "[elapsed_ms]",
        "repo": "[tmp]/store",
        "resolved": {
          "[grouped]": "[grouped]",
          "main": "[grouped]"
        }
      },
      "ok": true,
      "op": "check_lint",
      "result": {
        "checks": 0,
        "faults": [],
        "tree": "[id20]",
        "vouched": false
      }
    }
  }
}
```

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

It lints the tree of `rev` (default `main`) in the store the server was started on: there is no
directory form here, which `swarmops check lint --dir` serves on the command line. A tree with no
fault answers the result, `vouched: false`, with the `tree` it read and how many `checks` it looked
at. A tree with a fault is `E_CHECK_FILE` with `details.reason` `lint`, the first fault's `line` and
`key`, and every fault, at most 1,000, in `details.lint.faults`. A file that does not read is
`E_CHECK_FILE` with the reason `check_list` gives. Nothing runs a check, and nothing is written.

## Return information

A tool result: the envelope, whose `op` is `check_lint`, 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 check lint`](../commands/check-lint.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 `CheckLintReq`, a field named twice among them included, or that break one of the server's own rules.
- [`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 check lint`](../commands/check-lint.md#errors) lists them.

## See also

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