topos_inspect_code
Inspect a code unit (inline or file) to obtain per-function complexity, entropy, and evaluation lattice for detailed analysis behind a verdict.
Instructions
Full metric breakdown for a single code unit (inline string or
file).
Provide exactly one of code or filepath. Use when you need the
per-function detail behind a verdict; use topos_evaluate_* when the
medal alone is enough. Returns an InspectionResult: the lattice
evaluation, a top-N function complexity table
(top_n_functions, default 10), total_functions, and entropy
details.
With filepath, the verdict is scored on all three generators and
agrees with topos_evaluate_file: unless no_composable is set,
this generates/refreshes .gitnexus (given by gitnexus_dir or
auto-detected at <root>/.gitnexus) when missing or stale, then
attaches the ModuleDependencyGraph — so this tool is side-effecting.
With inline code there is no module to place in the graph, so only
SIMPLE/SECURE are reachable, as in topos_evaluate_code.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | ||
| allow | No | One-off acknowledged dangerous-call patterns for this inspection. | |
| verbose | No | Include raw probe metric floats under each file in the response. | |
| filepath | No | Path to the source file inside the project root. Prefer this for large files. | |
| language | No | Language for inline `code`; ignored for `filepath`, which is autodetected from the file extension. | python |
| preferences | No | Strict total order on the three generators; see `topos://docs/preferences`. | |
| gitnexus_dir | No | .gitnexus directory for COMPOSABLE scoring. When omitted, it is auto-detected at `<file root>/.gitnexus`; if missing or stale, this tool generates/refreshes it first (see `no_composable`). Only used with `filepath` — inline `code` has no module to place in the graph. | |
| no_composable | No | Skip GitNexus generation; score whatever `.gitnexus` is already there, or SIMPLE/SECURE only when there is none. | |
| top_n_functions | No | Return at most this many functions, sorted by descending cyclomatic complexity. Keeps agent context lean on large files. |