topos.mcp.metric_locations¶
Map failing SIMPLE complexity gates to concrete source locations.
topos_evaluate_file can report a failing ast.max_function_complexity
without telling the agent where to edit. This module derives the offending
function spans from the same AST probe that produces the gate metric, so the
location and the metric never disagree.
- topos.mcp.metric_locations.function_entry_from_complexity(fc, *, metric_source)[source]
Lift the probe dataclass into the MCP wire model.
- topos.mcp.metric_locations.build_metric_locations(source, language, result)[source]
Source locations for each failing SIMPLE complexity gate.
ast.max_function_complexityresolves to the offending functions (complexity above the per-function gate), sorted worst-first.cfg.cyclomaticis a whole-module count, so it gets akind='module'marker rather than a misleading function span.