get_dead_code
Detects dead code by combining import graph, call graph, and barrel export analysis with confidence scores, or via reachability from entry points. Returns dead symbols with confidence and signals for cleanup.
Instructions
Dead code detection. Two modes: (1) "multi-signal" (default) combines import graph, call graph, and barrel export analysis with confidence scores. (2) "reachability" runs forward BFS from auto-detected entry points (tests, package.json main/bin, src/{cli,main,index}, routes, framework-tagged controllers) — stricter but more accurate when entry points are enumerable. Pass entry_points to add custom roots. Both modes emit _methodology and _warnings. Use for comprehensive dead code analysis. For quick export-only scan use get_dead_exports; to safely remove detected dead code use remove_dead_code. Read-only. Returns JSON: { dead_symbols: [{ symbol_id, name, file, confidence, signals }], total }.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Detection algorithm (default: multi-signal) | |
| limit | No | Max results (default: 50) | |
| threshold | No | [multi-signal mode] Min confidence to report (default: 0.5 = at least 2 of 3 signals) | |
| entry_points | No | [reachability mode] Extra entry-point file paths (repo-relative) | |
| file_pattern | No | Filter by file glob pattern (e.g. "src/tools/%") |