# verify

URL: /milo-cli/api/milo/verify/
Section: milo
Description: Self-diagnosis for agent-built milo CLIs (`milo verify`).

Answers "is this CLI correctly built?" via six checks:

1. **Imports** — the file (or module) loads without error.
2. **CLI located** — a ``milo.CLI`` instance is reachable in the module.
3. **Commands registered** — at least one ``@cli.command`` has been attached.
4. **Schemas generate** — ``function_to_schema`` succeeds for every command;
   missing docstring ``Args:`` sections surface as warnings.
5. **In-process MCP list** — ``_list_tools(cli)`` returns a well-formed list
   with one entry per command.
6. **Subprocess MCP transport** — running ``python <file> --mcp`` responds to
   ``initialize`` and ``tools/list`` over JSON-RPC. (Skipped for module:attr
   inputs since there's no standalone entry point.)

The report distinguishes pass/warn/fail; `milo verify` exits non-zero only on
failures, not warnings.

---

> For a complete page index, fetch /milo-cli/llms.txt.

Open LLM text
(/milo-cli/api/milo/verify/index.txt)

Share with AI

Ask Claude
(https://claude.ai/new?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fmilo-cli%2Fapi%2Fmilo%2Fverify%2Findex.txt)

Ask ChatGPT
(https://chatgpt.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fmilo-cli%2Fapi%2Fmilo%2Fverify%2Findex.txt)

Ask Gemini
(https://gemini.google.com/app?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fmilo-cli%2Fapi%2Fmilo%2Fverify%2Findex.txt)

Ask Copilot
(https://copilot.microsoft.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fmilo-cli%2Fapi%2Fmilo%2Fverify%2Findex.txt)

Module

#
`verify`

Self-diagnosis for agent-built milo CLIs (`milo verify`).

Answers "is this CLI correctly built?" via six checks:

- Imports — the file (or module) loads without error.

- CLI located — a`milo.CLI`instance is reachable in the module.

- Commands registered — at least one`@cli.command`has been attached.

- Schemas generate —`function_to_schema`succeeds for every command;
missing docstring`Args:`sections surface as warnings.

- In-process MCP list —`_list_tools(cli)`returns a well-formed list
with one entry per command.

- Subprocess MCP transport — running`python <file> --mcp`responds to
`initialize` and `tools/list`over JSON-RPC. (Skipped for module:attr
inputs since there's no standalone entry point.)

The report distinguishes pass/warn/fail;`milo verify`exits non-zero only on
failures, not warnings.

2Classes6Functions

## Classes

`VerifyCheck`

4

▼

A single diagnostic check result.

A single diagnostic check result.

#### Attributes

Name
Type
Description

`name`

`str`

—

`status`

`str`

—

`message`

`str`

—

`details`

`str`

—

`VerifyReport`

8

▼

Aggregated verify report.

Aggregated verify report.

#### Attributes

Name
Type
Description

`target`

`str`

—

`checks`

`tuple[VerifyCheck, ...]`

—

#### Methods

`passed`

0

`int`

▼

property

`def passed(self) -> int`

##### Returns

`int`

`warnings`

0

`int`

▼

property

`def warnings(self) -> int`

##### Returns

`int`

`failures`

0

`int`

▼

property

`def failures(self) -> int`

##### Returns

`int`

`skipped`

0

`int`

▼

property

`def skipped(self) -> int`

##### Returns

`int`

`exit_code`

0

`int`

▼

property

`def exit_code(self) -> int`

##### Returns

`int`

`format`

0

`str`

▼

Render the report for terminal output.

`def format(self) -> str`

##### Returns

`str`

## Functions

`verify`

2

`VerifyReport`

▼

Run all verify checks against ``target``.

`def verify(target: str, *, timeout: float = 5.0) -> VerifyReport`

##### Parameters

Name
Type
Description

`target`
`str`

Either a filesystem path ending in`.py` or a `module:attr` reference. File paths are imported via `importlib.util` so no `sys.path` pollution is required; module:attr is resolved via the standard import machinery with the cwd added to `sys.path`.

`timeout`
`float`

Seconds to wait for the subprocess MCP handshake.

Default:`5.0`

##### Returns

`VerifyReport`

`_load_target`

1

`tuple[ModuleType | None,…`

▼

Import the target and return ``(module, file_path, import_check)``.

``file_pat…

`def _load_target(target: str) -> tuple[ModuleType | None, Path | None, VerifyCheck]`

Import the target and return`(module, file_path, import_check)`.

`file_path` is `None`for module:attr inputs. On failure the first
element is`None` and `import_check`carries the diagnosis.

##### Parameters

Name
Type
Description

`target`
`str`

##### Returns

`tuple[ModuleType | None, Path | None, VerifyCheck]`

`_find_cli_instance`

2

`CLI | VerifyCheck`

▼

Find the CLI instance in ``module``.

For ``module:attr`` targets, look up the …

`def _find_cli_instance(module: ModuleType, target: str) -> CLI | VerifyCheck`

Find the CLI instance in`module`.

For`module:attr`targets, look up the named attribute. For file-path
targets, scan the module for exactly one`CLI`instance.

##### Parameters

Name
Type
Description

`module`
`ModuleType`

`target`
`str`

##### Returns

`CLI | VerifyCheck`

`_check_schemas`

1

`VerifyCheck`

▼

Generate schemas for every command; surface docstring coverage gaps.

Coverage …

`def _check_schemas(command_list: list[tuple[str, Any]]) -> VerifyCheck`

Generate schemas for every command; surface docstring coverage gaps.

Coverage gaps come from`function_to_schema(..., warn_missing_docs=True)`
so verify sees the same undocumented-param judgement as production schema
generation would, were it opted in.

##### Parameters

Name
Type
Description

`command_list`
`list[tuple[str, Any]]`

##### Returns

`VerifyCheck`

`_check_in_process_mcp`

2

`VerifyCheck`

▼

Call ``_list_tools(cli)`` and validate shape.

`def _check_in_process_mcp(cli: CLI, expected_count: int) -> VerifyCheck`

##### Parameters

Name
Type
Description

`cli`
`CLI`

`expected_count`
`int`

##### Returns

`VerifyCheck`

`_check_subprocess_mcp`

2

`VerifyCheck`

▼

Start `python --mcp`, handshake, verify tools/list response.

`def _check_subprocess_mcp(path: Path, *, timeout: float) -> VerifyCheck`

##### Parameters

Name
Type
Description

`path`
`Path`

`timeout`
`float`

##### Returns

`VerifyCheck`
