get_circular_imports
Detect circular dependency chains in code imports to refactor and eliminate cycles. Excludes test files by default to avoid spurious cycles.
Instructions
Find circular dependency chains in the import graph (Kosaraju SCC algorithm). Considers only import-typed edges (esm_imports / imports / py_imports / py_reexports); call, reference, member_of, and test_covers edges are NOT walked. Test files (paths matching tests/**, **/.test., **/.spec., /tests/) are excluded by default to suppress spurious test↔source cycles — pass include_tests: true to opt in. Use to detect and break dependency cycles. Read-only. Returns JSON: { total_cycles, cycles: [{ files, length }] }.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| include_tests | No | Include test files in cycle detection. Default false — paths matching tests/**, **/*.test.*, **/*.spec.*, **/__tests__/** are excluded because they routinely produce spurious cycles (test imports source, while an indexer scan adds a reverse imports edge into the fixture). |