analyze_hook_deps
Identify missing or unnecessary React hook dependencies, async callbacks in useEffect, and missing cleanup functions to catch stale closure bugs.
Instructions
Analyze React hook dependencies in a file. Finds missing dependencies (bugs), unnecessary dependencies, async callbacks in useEffect, and cleanup functions. Essential for catching stale closure bugs.
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": {
"filePath": "<filePath>"
},
"name": "analyze_hook_deps"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Path to the TSX/JSX file to analyze | |
| hookTypes | No | Hook types to analyze (default: useEffect, useMemo, useCallback, etc.) | |
| componentName | No | Specific component to analyze (analyzes all if not provided) |