Skip to content

Verify format

verify_format

Compact text rendering for verify_project results.

The raw verify dict can reach 20k-80k tokens (esp. when TEST_QUALITY_DUPLICATE_TESTS returns 100+ clusters). The agent is the only consumer, so we drop the raw data and emit a compact text report instead.

Rendering policy:

  • finding.text: trust the rule — already compact, just indent each line by 2 spaces for visual coherence.
  • finding.details: descend (str → indent; list → top-N items; dict → look up known thematic keys, else JSON-truncate fallback).
  • finding.metadata (with clusters): keep legacy cluster summary.
  • fix_hint is shown verbatim, never truncated.

format_verify_text(result)

Render a verify_project result as a compact text report.

Parameters:

Name Type Description Default
result dict[str, object]

Output of verify_project — dict with audit and governance keys (each optional / nullable).

required

Returns:

Type Description
str

Multi-line string. Always starts with a 1-line header.

Source code in packages/axm-mcp/src/axm_mcp/verify_format.py
Python
def format_verify_text(result: dict[str, object]) -> str:
    """Render a verify_project result as a compact text report.

    Args:
        result: Output of ``verify_project`` — dict with ``audit`` and
            ``governance`` keys (each optional / nullable).

    Returns:
        Multi-line string. Always starts with a 1-line header.
    """
    audit = result.get("audit") if isinstance(result, dict) else None
    governance = result.get("governance") if isinstance(result, dict) else None

    parts: list[str] = [_format_header(audit, governance)]

    if isinstance(audit, dict):
        for failure in audit.get("failed", []) or []:
            parts.append("")
            parts.append(_format_finding(failure))

    if isinstance(governance, dict):
        for check in governance.get("failed", []) or []:
            parts.append("")
            parts.append(_format_governance(check))

    return "\n".join(parts)