> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lagerdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# DUT Context

> Author the device-under-test context that the MCP server hands to AI agents

`lager dut` manages the **DUT context** stored in `/etc/lager/bench.json` on
a Lager Box. This context tells AI agents (via the [MCP
server](https://docs.lagerdata.com/source/reference/mcp/overview.md)) what the box tests: purpose, MCU, key
peripherals, subsystem groupings, and references to schematics and datasheets.

See [Authoring DUT Context](https://docs.lagerdata.com/source/reference/mcp/dut-context.md) for the concepts
and workflow.

## Syntax

```bash theme={null}
lager dut [COMMAND] [OPTIONS]
```

## Options

The `lager dut` group takes only `--help`. Pass `--box` to each subcommand.

| Option | Description |
| - | - |
| `--box TEXT` | Lager Box name or IP address (on `show`, `edit` and `add-doc`) |
| `--help` | Show help message and exit |

## Commands

| Command | Description |
| - | - |
| `show` | Print the current DUT context as JSON |
| `edit` | Open the DUT context in `$EDITOR` for live editing |
| `add-doc` | Attach a schematic / datasheet / firmware reference to the DUT |

## Command Reference

### Show

Print the current DUT context as JSON.

```bash theme={null}
lager dut show --box my-lager-box
```

### Edit

Round-trip the DUT context through `$EDITOR` (falls back to `nano`, then `vi`).
On save, the new JSON is validated and written back to `/etc/lager/bench.json`.

```bash theme={null}
lager dut edit --box my-lager-box
```

The editable block accepts these fields:

| Field | Meaning |
| - | - |
| `name` | DUT slot name (e.g. `main`). |
| `active` | Whether this slot is the active DUT. |
| `purpose` | One-line description of what the box tests. |
| `summary` | Markdown paragraph: what the DUT is, known quirks. |
| `mcu` | The DUT's microcontroller (e.g. `STM32H7`). |
| `key_peripherals` | List of notable peripherals. |
| `schematic_refs` / `datasheet_refs` / `firmware_refs` / `extra_docs` | Lists of document references. |
| `subsystems` | Functional blocks, each with `name`, `summary`, `nets`, and `doc_refs`. |

### Add Doc

Attach a single document reference to the active DUT without hand-editing JSON.
The box records only a pointer — it does **not** store the file. The agent
fetches and analyses it with its own tools.

```bash theme={null}
lager dut add-doc --kind schematic \
  --title "Main board" --repo-path docs/sch.pdf --pages 3-5 --box my-lager-box
```

**Options:**

| Option | Description |
| - | - |
| `--kind` | `schematic`, `layout`, `datasheet`, `firmware`, `manual`, `errata`, or `other` (default `schematic`). |
| `--title TEXT` | Human label for the document (required). |
| `--url TEXT` | External URL. |
| `--repo-path TEXT` | Path relative to your test project (synced to the box on `lager python`). |
| `--external-id TEXT` | ID of the document in an external document store. |
| `--external-url TEXT` | URL of the document in an external document store. |
| `--pages TEXT` | Optional page/sheet hint, e.g. `"3-5"` or `"POWER sheet"`. |
| `--notes TEXT` | Optional free-form note. |

You must supply at least one of `--url`, `--repo-path`, `--external-id` or
`--external-url`. The reference is
appended to the list matching `--kind` (`schematic` → `schematic_refs`,
`datasheet` → `datasheet_refs`, `firmware` → `firmware_refs`; everything else →
`extra_docs`).

## After editing

The MCP server watches `/etc/lager/bench.json`, `/etc/lager/saved_nets.json` and
`/etc/lager/box_id`. When one of them changes on disk, the server reloads on the next
request, so agents see your changes with no manual step.

To force a reload at once, have a connected agent call the `box_manage` tool with
`action="reload"`. You can also restart the box service.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.