analyze_imports
Find what imports a file, detect unused exports, and identify circular dependencies by analyzing import/export relationships. Uses a cached graph for fast repeated queries.
Instructions
Analyze import/export relationships for a file. Find what imports this file (importedBy), detect unused exports, and circular dependencies. Uses cached import graph for fast subsequent queries. Returns summary + limited results.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"projectPath": "<projectPath>",
"filePath": "<filePath>"
},
"name": "analyze_imports"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Max results per category (default: 10, max: 50) | |
| exclude | No | File patterns to exclude | |
| include | No | File patterns to include | |
| filePath | Yes | File to analyze (relative to project root) | |
| direction | No | What to analyze: imports (what this file imports), importedBy (what imports this file), or both (default: both) | |
| projectPath | Yes | Root path of the project | |
| includeUnused | No | Include unused exports analysis - exports not imported by any file in the project (default: true) | |
| detectCircular | No | Detect circular dependencies involving this file (default: true) |