Module

verify

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 — amilo.CLIinstance is reachable in the module.
  3. Commands registered — at least one@cli.commandhas been attached.
  4. Schemas generatefunction_to_schemasucceeds for every command; missing docstringArgs: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 — runningpython <file> --mcpresponds to initialize and tools/listover JSON-RPC. (Skipped for module:attr inputs since there's no standalone entry point.)

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

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 Nonefor module:attr inputs. On failure the first element isNone and import_checkcarries 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 inmodule.

Formodule:attrtargets, look up the named attribute. For file-path targets, scan the module for exactly oneCLIinstance.

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 fromfunction_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