get_dead_code
Identify dead code in your codebase using multi-signal analysis (import, call graph, barrel exports) or reachability from entry points. Get confident results to optimize your project.
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/%") |