Measures code complexity for refactoring decisions. Supports cyclomatic complexity (number of independent test paths) and cognitive complexity (how hard code is to understand). Returns per-function scores with grades from A to F.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| uri | string | Yes | -- | File URI to analyze (e.g., file:///path/to/file.ts) |
| line | number | No | -- | Line number to analyze a specific function (0-indexed). Omit to analyze all functions in the file. |
| type | enum | No | cyclomatic | Type of analysis: cyclomatic (test paths), cognitive (readability), or all (both) |
| threshold | number | No | 10 | Complexity threshold for flagging. Functions below this are not flagged. |
| summary | boolean | No | false | Return a condensed summary |
Natural Language: "Check the complexity of all functions in the router file"
MCP Tool Call:
{
"name": "stellarion_analyze_complexity",
"arguments": {
"uri": "file:///home/dev/project/src/api/router.ts",
"type": "all"
}
}
Returns: Per-function cyclomatic and cognitive scores for every function in the file, each with a letter grade and detailed breakdown.
Natural Language:
"How complex is the parseConfig function?"
MCP Tool Call:
{
"name": "stellarion_analyze_complexity",
"arguments": {
"uri": "file:///home/dev/project/src/config/parser.rs",
"line": 25,
"type": "cognitive"
}
}
Returns: Cognitive complexity score for parseConfig with a breakdown showing which nesting levels and control flow structures contribute most to the score.
Natural Language: "Show me functions with complexity above 15"
MCP Tool Call:
{
"name": "stellarion_analyze_complexity",
"arguments": {
"uri": "file:///home/dev/project/src/engine/processor.py",
"threshold": 15,
"type": "cyclomatic"
}
}
Returns: Only functions exceeding the threshold of 15, sorted by complexity score.
Each function in the response includes:
cyclomatic or all)cognitive or all)continue, break, nested conditions).type: "all" for a comprehensive view. A function can have low cyclomatic but high cognitive complexity (deeply nested but few branches) or vice versa.stellarion_tech_debt_report (Pro) to see complexity hotspots in the context of overall codebase health.