Module

verify

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

Answers "is this CLI correctly built?" via ten 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. MCP discoveryserver/discoverreports the supported protocol versions, capabilities, and server info used by stateless MCP clients.
  7. In-process MCP Apps — negotiated tools, UI resources, metadata, and payload reads agree without interpreting application HTML.
  8. Gateway MCP Apps — a single-child gateway preserves and rewrites every tool-to-resource link without dropping metadata.
  9. Subprocess MCP transport — runningpython <file> --mcpresponds to server/discover, then the legacy initializehandshake, and tools/listover JSON-RPC. (Skipped for module:attr inputs since there's no standalone entry point.)
  10. Subprocess MCP Apps — the same process negotiates the MCP Apps extension, lists matching tool/resource views, and reads each UI resource.

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
_VerifyGatewayChild 3
In-process child adapter used only to exercise the real gateway projection.

In-process child adapter used only to exercise the real gateway projection.

Methods

fetch_tools 0 list[dict[str, Any]]
def fetch_tools(self) -> list[dict[str, Any]]
Returns
list[dict[str, Any]]
send_call 2 dict[str, Any]
def send_call(self, method: str, params: dict[str, Any]) -> dict[str, Any]
Parameters
Name Type Description
method
params
Returns
dict[str, Any]
Internal Methods 1
__init__ 1
def __init__(self, cli: CLI) -> None
Parameters
Name Type Description
cli

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_mcp_discovery 1 VerifyCheck
Verify ``server/discover`` advertises the active MCP contract.
def _check_mcp_discovery(cli: CLI) -> VerifyCheck
Parameters
Name Type Description
cli CLI
Returns
VerifyCheck
_mcp_apps_params 0 dict[str, Any]
Return the one canonical MCP Apps client capability declaration.
def _mcp_apps_params() -> dict[str, Any]
Returns
dict[str, Any]
_mcp_apps_capability_issues 2 list[str]
Validate a discovery/initialize result's MCP Apps declaration.
def _mcp_apps_capability_issues(result: Any, *, surface: str) -> list[str]
Parameters
Name Type Description
result Any
surface str
Returns
list[str]
_metadata_issues 2 list[str]
Validate protocol-level MCP Apps resource metadata types.
def _metadata_issues(meta: Any, *, surface: str) -> list[str]
Parameters
Name Type Description
meta Any
surface str
Returns
list[str]
_resource_entries 2 tuple[dict[str, dict[str…
Collect MCP Apps resources and report malformed protocol entries.
def _resource_entries(resources: list[Any], *, surface: str) -> tuple[dict[str, dict[str, Any]], list[str]]
Parameters
Name Type Description
resources list[Any]
surface str
Returns
tuple[dict[str, dict[str, Any]], list[str]]
_tool_links 2 tuple[list[tuple[str, st…
Collect nested MCP Apps tool metadata and validate its wire shape.
def _tool_links(tools: list[Any], *, surface: str) -> tuple[list[tuple[str, str, dict[str, Any]]], list[str]]
Parameters
Name Type Description
tools list[Any]
surface str
Returns
tuple[list[tuple[str, str, dict[str, Any]]], list[str]]
_content_issues 4 list[str]
Validate one resources/read result without parsing application HTML.
def _content_issues(result: Any, *, uri: str, listed_resource: dict[str, Any], surface: str) -> list[str]
Parameters
Name Type Description
result Any
uri str
listed_resource dict[str, Any]
surface str
Returns
list[str]
_mcp_apps_view_issues 4 tuple[list[str], int, in…
Validate linked tool, resource-list, and optional resource-read views.
def _mcp_apps_view_issues(tools: Any, resources: Any, *, surface: str, read_resource: Callable[[str], dict[str, Any]] | None = None) -> tuple[list[str], int, int, int]
Parameters
Name Type Description
tools Any
resources Any
surface str
read_resource Callable[[str], dict[str, Any]] | None Default:None
Returns
tuple[list[str], int, int, int]
_failed_conformance 2 VerifyCheck
Build one stable failure row from actionable conformance findings.
def _failed_conformance(name: str, issues: list[str]) -> VerifyCheck
Parameters
Name Type Description
name str
issues list[str]
Returns
VerifyCheck
_registered_link_issues 1 list[str]
Validate links that may be app-only and therefore absent from tools/list.
def _registered_link_issues(cli: CLI) -> list[str]
Parameters
Name Type Description
cli CLI
Returns
list[str]
_check_mcp_apps_in_process 1 VerifyCheck
Validate negotiated MCP Apps views and payload reads in-process.
def _check_mcp_apps_in_process(cli: CLI) -> VerifyCheck
Parameters
Name Type Description
cli CLI
Returns
VerifyCheck
_check_mcp_apps_gateway 1 VerifyCheck
Project one CLI through the real gateway and compare every UI link.
def _check_mcp_apps_gateway(cli: CLI) -> VerifyCheck
Parameters
Name Type Description
cli CLI
Returns
VerifyCheck
_ui_resource_uris 1 tuple[str, ...]
Return deterministic registered and linked UI URIs for wire reads.
def _ui_resource_uris(cli: CLI) -> tuple[str, ...]
Parameters
Name Type Description
cli CLI
Returns
tuple[str, ...]
_check_subprocess_mcp 3 tuple[VerifyCheck, Verif…
Start ``python --mcp`` and verify base plus MCP Apps transport.
def _check_subprocess_mcp(path: Path, *, timeout: float, ui_resource_uris: tuple[str, ...]) -> tuple[VerifyCheck, VerifyCheck]
Parameters
Name Type Description
path Path
timeout float
ui_resource_uris tuple[str, ...]
Returns
tuple[VerifyCheck, VerifyCheck]
_response_result 3 tuple[dict[str, Any] | N…
Return one JSON-RPC result object or an actionable transport issue.
def _response_result(responses: dict[int, dict[str, Any]], request_id: int, method: str) -> tuple[dict[str, Any] | None, str | None]
Parameters
Name Type Description
responses dict[int, dict[str, Any]]
request_id int
method str
Returns
tuple[dict[str, Any] | None, str | None]
_check_base_transport_responses 3 VerifyCheck
Validate the existing discovery/initialize/tools subprocess contract.
def _check_base_transport_responses(responses: dict[int, dict[str, Any]], *, stdout_issues: list[str], stderr_excerpt: str) -> VerifyCheck
Parameters
Name Type Description
responses dict[int, dict[str, Any]]
stdout_issues list[str]
stderr_excerpt str
Returns
VerifyCheck
_check_apps_transport_responses 4 VerifyCheck
Validate negotiated MCP Apps lists and reads over subprocess JSON-RPC.
def _check_apps_transport_responses(responses: dict[int, dict[str, Any]], *, read_ids: dict[str, int], stdout_issues: list[str], stderr_excerpt: str) -> VerifyCheck
Parameters
Name Type Description
responses dict[int, dict[str, Any]]
read_ids dict[str, int]
stdout_issues list[str]
stderr_excerpt str
Returns
VerifyCheck