find_circular
Detects circular dependencies in static imports. Finds cycles like A→B→C→A to debug compilation issues and improve code architecture.
Instructions
Detect circular dependencies in the codebase.
Purpose: Find dependency cycles (A → B → C → A).
Pagination: Default limit of 200 results per page. Check response.pagination.has_more to fetch more pages.
Sorting: Default order is descending (longest cycles first). Use sort parameter to change.
Returns: Object with pagination metadata and array of cycles, where each cycle is an array of file paths forming the circular path.
Use this when:
Debugging circular dependency issues
Improving code architecture
Validating refactoring
IMPORTANT: Only detects cycles in static imports (string literals). Dynamic imports are filtered. See CLAUDE.md section "Dependency/Import Extraction" for details.
Note: Circular dependencies can cause compilation issues and indicate architectural problems.
Example output: {"pagination": {...}, "results": [{"paths": ["a.rs", "b.rs", "a.rs"]}]}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of cycles per page (default: 200) | |
| offset | No | Pagination offset (skip first N cycles). Use with limit for pagination. | |
| sort | No | Sort order: 'asc' (shortest cycles first) or 'desc' (longest cycles first, default) |