Get Solution Metrics
solution_metricsGet a solution-wide production-code quality rollup in one call and evaluate --fail-on gate expressions for before/after comparisons.
Instructions
The solution-wide quality rollup in one call - the numbers the CLI '--fail-on' quality gate evaluates. symbol_metrics ranks single methods; list_insights shows the findings behind the severity counts.
Use it for a before/after number, or to try a gate expression.
Returns metrics {typeCount, methodCount, complexityMax, complexityAvg, methodsOverComplexityThreshold, ceMax, caMax}, scope (always 'production'), testMethodCount, testTypeCount, severities {critical, warning, info, ok}, debtMinutes, debtApprox, debtRating, complexityThreshold, qualityProfile, layerProfile (when one is in force), knownGateMetrics and, with failOn, gate {expression, passed, violatedClauses}. degradedProducers appears when an insight producer failed; severities and debt are then incomplete. debtMinutes is a coarse estimate from fixed per-finding rules, not measured effort; debtApprox rounds it (1 d = 8 h).
PRODUCTION code only - test projects, per the session's test profile, are excluded from every number, and testMethodCount / testTypeCount give the excluded side. Types are logical (partial fragments merged, multi-TFM deduplicated); methods exclude constructors and accessors. methodsOverComplexityThreshold counts STRICTLY greater than complexityThreshold, while symbol_metrics' minComplexity is inclusive. ceMax / caMax: coupling maxima (caMaxNote: same-named types could raise caMax). severities count insights - one per producer that found something - not findings. The rollup is NOT triage-filtered: suppressed and dismissed findings still count, as in the CLI gate, so debt and severities can be higher than what list_insights shows.
failOn takes the tokens in knownGateMetrics; this gate is advisory, the blocking one is the CLI's.
Profiles: the active QualityProfile of the config DB in force (see dbPath); the session's layer profile, else the one dbPath (or, omitted, the session's analysis DB) configures. Writes nothing of its own; an older dbPath DB is upgraded on open, as the server's own is at startup. Works on a recalled session.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dbPath | No | Optional path to an AIContextBuilder SQLite DB. When set, the complexity threshold and producer toggles come from that DB's active QualityProfile (same semantics as list_insights); omit to fall back to the server's default config DB (the GUI's, if resolved), else the default profile. Omitted, the layer profile comes from the config DB the session was analysed against. | |
| failOn | No | Optional quality-gate expression to evaluate against the rollup (CLI '--fail-on' syntax, e.g. 'critical>0 OR debt>120min OR ce-max>50'). An invalid expression or unknown metric is rejected with the known tokens. | |
| sessionId | Yes | The session_id returned by analyze_solution. Also takes an absolute .sln/.slnx/.slnf path, analyzed on first use. |