pyscn
v1.33.2Python code analysis for AI agents: complexity, dead code, clones, coupling, and a health score.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
analyze_code
Comprehensive Python code quality analysis with complexity, dead code, clone detection, and coupling metrics
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to Python code (file or directory) to analyze |
analyses | array | Array of analyses to run. Options: complexity, dead_code, clone, cbo, lcom, deps, communities. Default: all analyses, including communities |
output_mode | string | Response detail level. "summary" (default) returns health score and high-level metrics. "full" returns the complete report including community_analysis and its compact community_context_map when commu… |
recursive | boolean | Recursively analyze directories (default: true) |
check_cohesion
Analyze class cohesion (LCOM4 - Lack of Cohesion of Methods) metrics
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to Python code to analyze |
max_results | integer | Maximum findings in summary or detailed output; 0 means unlimited (default: 0) |
output_mode | string | Response detail level (default: summary) |
check_complexity
Analyze cyclomatic complexity of Python execution scopes
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to Python code to analyze |
max_complexity | number | Maximum allowed complexity (default: 10; 0 uses the default) |
max_results | integer | Maximum findings in summary or detailed output; 0 means unlimited (default: 0) |
min_complexity | number | Minimum complexity to report (default: 1) |
output_mode | string | Response detail level (default: summary) |
show_details | boolean | Include detailed metrics (default: true) |
check_coupling
Analyze class coupling (CBO - Coupling Between Objects) metrics
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to Python code to analyze |
max_results | integer | Maximum findings in summary or detailed output; 0 means unlimited (default: 0) |
min_cbo | integer | Minimum CBO for high-coupling findings (default: 10) |
output_mode | string | Response detail level (default: summary) |
detect_clones
Detect code clones using APTED tree edit distance and LSH acceleration
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to Python code to analyze |
group_clones | boolean | Group related clones together (default: true) |
max_results | integer | Maximum findings in summary or detailed output; 0 means unlimited (default: 0) |
min_lines | number | Minimum SLOC to consider as clone (default: 8) |
output_mode | string | Response detail level (default: summary) |
similarity_threshold | number | Minimum similarity threshold 0.0-1.0 (default: 0.8) |
detect_di_antipatterns
Detect Dependency Injection anti-patterns in Python code (constructor over-injection, hidden dependencies, concrete dependencies, service locator)
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to Python code to analyze |
constructor_param_threshold | number | Maximum allowed constructor parameters (default: 5) |
min_severity | string | Minimum severity: info, warning, error (default: warning) |
find_dead_code
Find unreachable code using Control Flow Graph (CFG) analysis
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to Python code to analyze |
max_results | integer | Maximum findings in summary or detailed output; 0 means unlimited (default: 0) |
min_severity | string | Minimum severity: info, warning, error (default: warning) |
output_mode | string | Response detail level (default: summary) |
get_health_score
Get overall code health score (0-100) with grade and category scores
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to Python code to analyze |