complexity_hotspots
Retrieve code nodes with cyclomatic complexity above a given threshold to identify high-risk areas in your codebase.
Instructions
Return nodes whose cyclomatic complexity meets the threshold.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "complexity_hotspots"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| threshold | No | ||
| session_id | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- The core handler for complexity_hotspots — delegates to engine.complexity_hotspots(threshold) on the QueryEngine instance stored in the current session handle.
def complexity_hotspots( self, threshold: int = 10, session_id: str | None = None, ) -> list[dict[str, Any]]: return self._require_scanned_handle(session_id).engine.complexity_hotspots(threshold) - ToolSpec schema defining the tool name, category (navigation), description, and parameters (threshold: integer with default 10, session_id: string|null).
name="complexity_hotspots", category="navigation", description="Return nodes whose cyclomatic complexity meets the threshold.", parameters={"threshold": _param("integer", default=10), "session_id": SESSION_ID_PARAM}, ), - src/trailmark_mcp/mcp_app.py:105-108 (registration)MCP tool registration via @mcp.tool() decorator — wraps the runtime method with FastMCP, exposing the tool to the MCP server.
@mcp.tool() def complexity_hotspots(threshold: int = 10, session_id: str | None = None) -> list[dict[str, Any]]: """Return nodes whose cyclomatic complexity meets the threshold.""" return app_runtime.complexity_hotspots(threshold=threshold, session_id=session_id) - Helper usage during save_snapshot: writes engine.complexity_hotspots(10) to a 'hotspots.json' snapshot file.
self._write_json(snapshot_dir / "hotspots.json", engine.complexity_hotspots(10))