pyscn

v1.33.2
io.github.ludo-technologies/pyscn Checked 3 hours ago Published 23 days ago

Python 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

ParameterTypeDescription
path *stringPath to Python code (file or directory) to analyze
analysesarrayArray of analyses to run. Options: complexity, dead_code, clone, cbo, lcom, deps, communities. Default: all analyses, including communities
output_modestringResponse 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…
recursivebooleanRecursively analyze directories (default: true)

check_cohesion

Analyze class cohesion (LCOM4 - Lack of Cohesion of Methods) metrics

ParameterTypeDescription
path *stringPath to Python code to analyze
max_resultsintegerMaximum findings in summary or detailed output; 0 means unlimited (default: 0)
output_modestringResponse detail level (default: summary)

check_complexity

Analyze cyclomatic complexity of Python execution scopes

ParameterTypeDescription
path *stringPath to Python code to analyze
max_complexitynumberMaximum allowed complexity (default: 10; 0 uses the default)
max_resultsintegerMaximum findings in summary or detailed output; 0 means unlimited (default: 0)
min_complexitynumberMinimum complexity to report (default: 1)
output_modestringResponse detail level (default: summary)
show_detailsbooleanInclude detailed metrics (default: true)

check_coupling

Analyze class coupling (CBO - Coupling Between Objects) metrics

ParameterTypeDescription
path *stringPath to Python code to analyze
max_resultsintegerMaximum findings in summary or detailed output; 0 means unlimited (default: 0)
min_cbointegerMinimum CBO for high-coupling findings (default: 10)
output_modestringResponse detail level (default: summary)

detect_clones

Detect code clones using APTED tree edit distance and LSH acceleration

ParameterTypeDescription
path *stringPath to Python code to analyze
group_clonesbooleanGroup related clones together (default: true)
max_resultsintegerMaximum findings in summary or detailed output; 0 means unlimited (default: 0)
min_linesnumberMinimum SLOC to consider as clone (default: 8)
output_modestringResponse detail level (default: summary)
similarity_thresholdnumberMinimum 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)

ParameterTypeDescription
path *stringPath to Python code to analyze
constructor_param_thresholdnumberMaximum allowed constructor parameters (default: 5)
min_severitystringMinimum severity: info, warning, error (default: warning)

find_dead_code

Find unreachable code using Control Flow Graph (CFG) analysis

ParameterTypeDescription
path *stringPath to Python code to analyze
max_resultsintegerMaximum findings in summary or detailed output; 0 means unlimited (default: 0)
min_severitystringMinimum severity: info, warning, error (default: warning)
output_modestringResponse detail level (default: summary)

get_health_score

Get overall code health score (0-100) with grade and category scores

ParameterTypeDescription
path *stringPath to Python code to analyze