code-health-suite
v0.8.116 engines, 28 MCP tools for Python code quality.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
analyze_complexity
Analyze Python code complexity for a file or directory. Returns per-function metrics: cyclomatic complexity (McCabe), cognitive complexity, nesting depth, function length, and letter grades (A-F).
| Parameter | Type | Description |
|---|---|---|
path * | string | File or directory path to analyze. |
sort_by | string | Sort metric (default: complexity). |
threshold | integer | Cyclomatic complexity threshold (default: 10). |
top | integer | Return only top N functions by complexity. 0 = all. |
get_complexity_score
Get an overall complexity health score (0-100) with letter grade (A-F), complexity profile classification, and top offenders. Quick project health check.
| Parameter | Type | Description |
|---|---|---|
path * | string | Directory path to analyze. |
find_dead_code
Detect unused imports, functions, variables, and arguments in Python code. Supports cross-module analysis to reduce false positives.
| Parameter | Type | Description |
|---|---|---|
path * | string | File or directory path to scan. |
category | string | Filter by category. Omit for all categories. |
min_severity | string | Minimum severity level (default: info). |
security_scan
Scan Python code for security vulnerabilities: command injection, SQL injection, path traversal, hardcoded secrets, unsafe deserialization, XSS, and more. Maps findings to CWE identifiers.
| Parameter | Type | Description |
|---|---|---|
path * | string | File or directory path to scan. |
get_security_score
Get an overall security health score (0-100) with grade, profile, and top vulnerability rules. Quick security posture assessment.
| Parameter | Type | Description |
|---|---|---|
path * | string | Directory path to scan. |
analyze_imports
Analyze Python import dependency graph. Returns module metrics, circular dependencies (cycles), orphan modules, hub modules, and instability scores. Use to understand project architecture.
| Parameter | Type | Description |
|---|---|---|
path * | string | Root directory of the Python project to analyze. |
get_import_health
Get an import graph health score (0-100) with grade. Penalizes circular dependencies, orphan modules, unstable modules, and hub concentration. Quick architecture health check.
| Parameter | Type | Description |
|---|---|---|
path * | string | Root directory to analyze. |
find_clones
Detect code clones (duplicated code blocks) in a Python project. Finds Type-1 (exact), Type-2 (renamed), and Type-3 (near-miss) clones. Returns clone pairs with similarity scores and cluster analysis.
| Parameter | Type | Description |
|---|---|---|
path * | string | Directory path to scan for clones. |
min_lines | integer | Minimum function length to consider (default: 5). |
threshold | number | Similarity threshold 0.0-1.0 (default: 0.8). |
analyze_test_quality
Analyze test suite quality: assertion density, test length, naming conventions, magic numbers, and more. Returns per-file and per-test metrics with a quality score (0-100) and grade.
| Parameter | Type | Description |
|---|---|---|
path * | string | Root directory containing test files. |
max_length | integer | Max test function length before flagging (default: 50). |
find_hotspots
Find code hotspots — files with high git churn AND high complexity. These are the riskiest files in a project: frequently changed AND hard to understand. Requires a git repository. Returns hotspot scores, risk levels, and churn/complexity breakdown.
| Parameter | Type | Description |
|---|---|---|
path * | string | Git repository root path. |
since_days | integer | Look back N days for churn data (default: 180). |
top | integer | Return top N hotspots (default: 20). |
get_hotspot_score
Get overall hotspot health score (0-100) with grade. Measures concentration of risk (churn x complexity). Lower scores indicate more hotspots that need attention.
| Parameter | Type | Description |
|---|---|---|
path * | string | Git repository root path. |
audit_dependencies
Audit Python project dependencies for outdated packages and known vulnerabilities. Reads requirements.txt and/or pyproject.toml. Returns per-dependency status, latest versions, and CVE/vulnerability details.
| Parameter | Type | Description |
|---|---|---|
path * | string | Project root directory containing requirements.txt or pyproject.toml. |
analyze_change_impact
Analyze the ripple effect of changing specific files. Shows direct dependents, transitive impact, affected tests, and an impact score (fraction of project affected). Use before refactoring to understand blast radius.
| Parameter | Type | Description |
|---|---|---|
changed_files * | array | List of file paths (relative to root) that are being changed. |
path * | string | Project root directory. |
max_depth | integer | Max transitive dependency depth (default: 10). |
analyze_coupling
Analyze module coupling metrics: afferent coupling (Ca), efferent coupling (Ce), instability (Ce/(Ca+Ce)), and hub scores. Identifies tightly-coupled modules that may resist change.
| Parameter | Type | Description |
|---|---|---|
path * | string | Project root directory. |
analyze_type_coverage
Analyze Python type annotation coverage: function signatures, parameters, return types, Any usage, and type: ignore comments. Returns per-file metrics and coverage percentages.
| Parameter | Type | Description |
|---|---|---|
path * | string | File or directory path to analyze. |
get_type_score
Get overall type coverage health score (0-100) with grade. Measures annotation completeness, Any usage, and type: ignore density.
| Parameter | Type | Description |
|---|---|---|
path * | string | File or directory path to analyze. |
audit_env_vars
Audit environment variable usage: find undefined vars referenced in code, unused vars in .env files, secrets in templates, and missing .env.example entries. Supports Python, JavaScript, and shell scripts.
| Parameter | Type | Description |
|---|---|---|
path * | string | Project root directory. |
audit_git_commits
Audit recent git commits in a repository. Extracts changed files and runs static analysis (security scan, complexity) on each commit. Returns per-commit grades, security findings, and complexity violations.
| Parameter | Type | Description |
|---|---|---|
repo * | string | Path to the git repository to audit. |
author | string | Filter commits by author name. |
commits | integer | Number of recent commits to audit (default: 10). |
severity | string | Minimum security finding severity (default: low). |
since | string | Audit commits since date (e.g., '3 days ago', '2026-03-01'). |
threshold | integer | Complexity threshold for flagging functions (default: 10). |
get_git_audit_score
Get a quick overall grade and score for recent commits in a repo. Returns the aggregate score, grade, commit count, and security summary.
| Parameter | Type | Description |
|---|---|---|
repo * | string | Path to the git repository. |
commits | integer | Number of recent commits to audit (default: 10). |
check_naming
Check Python naming conventions (PEP 8). Detects violations: functions/methods must be snake_case, classes must be CamelCase, constants must be UPPER_SNAKE_CASE. Returns violations with suggestions.
| Parameter | Type | Description |
|---|---|---|
path * | string | File or directory path to check. |
get_naming_score
Get a naming convention health score (0-100) with grade. Measures PEP 8 naming compliance: snake_case functions, CamelCase classes, UPPER_SNAKE_CASE constants.
| Parameter | Type | Description |
|---|---|---|
path * | string | Directory path to check. |
scan_todos
Scan source code for technical debt markers: TODO, FIXME, HACK, XXX, BUG, NOTE, OPTIMIZE, REFACTOR comments. Returns items with file, line, tag, severity, and message. Optionally enriches with git blame metadata.
| Parameter | Type | Description |
|---|---|---|
path * | string | File or directory path to scan. |
blame | boolean | Enrich with git blame metadata (author, date). Slower. |
severity | string | Filter by minimum severity level. |
tag | string | Filter by specific tag (e.g., TODO, FIXME, HACK). |
get_todo_score
Get a technical debt health score (0-100) with grade based on density and severity of TODO/FIXME/HACK markers. Shows hotspot files.
| Parameter | Type | Description |
|---|---|---|
path * | string | Directory path to scan. |
detect_bugs
Detect common Python semantic bugs using AST analysis. Finds 8 categories: missing f-strings, mutable class variables, late-binding closures, call-expression defaults (datetime.now()), mutable default arguments, assert-on-tuple, unreachable code, and unreachable exception handlers. Every finding indicates a likely real bug, not a style violation.
| Parameter | Type | Description |
|---|---|---|
path * | string | File or directory path to scan. |
min_severity | string | Minimum severity to report (default: info). |
rules | array | Filter by specific rules. Options: missing-fstring, mutable-class-var, late-binding-closure, call-default, mutable-default-arg, assert-tuple, unreachable-code, unreachable-except. Omit for all rules. |
get_bug_score
Get a bug detection health score (0-100) with grade (A-F), bug profile classification (clean/fstring_heavy/closure_heavy/etc.), and breakdown by rule and severity. Quick bug health check.
| Parameter | Type | Description |
|---|---|---|
path * | string | Directory path to scan. |
audit_docstrings
Audit Python docstring coverage and quality. Checks public functions, methods, classes, and modules for missing or low-quality docstrings. Returns per-entity coverage, missing docstrings, and quality issues.
| Parameter | Type | Description |
|---|---|---|
path * | string | File or directory path to audit. |
get_docstring_score
Get a docstring coverage health score (0-100) with grade. Measures what percentage of public entities have docstrings and penalizes low-quality docstrings. Shows worst files.
| Parameter | Type | Description |
|---|---|---|
path * | string | Directory path to audit. |
full_health_check
Run all analyses (complexity + dead code + security + imports + clones + test quality + type coverage + env audit + naming + TODO debt + bug detection + docstring coverage) on a Python project and return a combined health report with scores, grades, and top issues. Note: hotspot, dependency, and change impact require additional context (git repo, requirements files, changed files) so are excluded from this scan.
| Parameter | Type | Description |
|---|---|---|
path * | string | Directory path to analyze. |