# get_impact_radius_tool vs detect_changes_tool in code-review-graph: Impact Analysis vs Full Review

> Understand the difference between get impact radius tool and detect changes tool in code-review-graph. Discover impact analysis vs full review for efficient code reviews.

- Repository: [Tirth Kanani/code-review-graph](https://github.com/tirth8205/code-review-graph)
- Tags: deep-dive
- Published: 2026-08-09

---

**The `get_impact_radius_tool` returns the raw blast radius of code changes through dependency graph traversal, while `detect_changes_tool` orchestrates a complete review workflow including diff parsing, risk scoring, and test-gap detection.**

The `code-review-graph` repository by tirth8205 provides two high-level MCP tools for analyzing code changes, but they operate at fundamentally different layers of abstraction. While both leverage the underlying dependency graph engine, these tools serve distinct use cases ranging from quick impact queries to comprehensive pre-commit reviews. Understanding the precise differences between `get_impact_radius_tool` and `detect_changes_tool` helps developers select the appropriate instrument for their specific code analysis needs.

## Primary Purpose and Architectural Scope

**`get_impact_radius_tool`** focuses exclusively on **graph traversal** to determine which functions, classes, and files are impacted by a given set of changes. Its primary goal is to answer the question: *"What else might break if I touch this file?"* This makes it ideal for refactor planning, ad-hoc exploration, and impact queries from IDE extensions.

**`detect_changes_tool`** executes a full **change-detection workflow** that encompasses six distinct stages: discovering changed files, parsing the Git diff, mapping changes to specific functions, computing the impact radius, adding risk scores and test-gap detection, and surfacing review priorities. This tool serves as the primary code-review instrument for pre-commit or PR review scenarios.

## Input Parameters and Configuration

Both tools accept overlapping parameters but handle inputs differently.

**`get_impact_radius_tool`** accepts an optional list of changed files; when omitted, the tool auto-detects them from `git diff` without performing deep diff parsing. It supports a `max_depth` parameter (default `2`) that limits BFS traversal hops in the dependency graph.

**`detect_changes_tool`** accepts either an optional list of changed files **or** a `base` ref (default `HEAD~1`). Unlike its counterpart, this tool actively runs `git diff` and parses line-range information. It passes the same `max_depth` argument to the underlying impact-radius calculation but also uses it to bound ancillary analyses such as community impact and test-gap searches.

## Output Data Structures and Return Values

The tools return fundamentally different data models reflecting their distinct purposes.

**`get_impact_radius_tool`** returns a focused set of graph data:

- `changed_nodes`: Nodes corresponding to the supplied files
- `impacted_nodes`: Nodes reachable within `max_depth` hops
- `impacted_files`: List of affected file paths
- `edges`: The graph edges connecting impacted nodes

**`detect_changes_tool`** returns a comprehensive analysis object containing:

- `changed_files` or `changed_functions` (when `include_source=True`)
- Full `analysis` object with **risk scores**, **affected flows**, **test gaps**, and **review priorities**
- Optional source snippets for changed functions
- A compact "minimal" view returning summary statistics and top-3 review priorities

## Implementation in Source Code

Both tools are defined in [`code_review_graph/main.py`](https://github.com/tirth8205/code-review-graph/blob/main/code_review_graph/main.py), but their implementations diverge significantly.

**`get_impact_radius_tool`** is defined at lines 19-27 in [`code_review_graph/main.py`](https://github.com/tirth8205/code-review-graph/blob/main/code_review_graph/main.py) and forwards directly to the internal `get_impact_radius` function. This implementation remains lightweight, focusing purely on graph neighborhood calculation.

**`detect_changes_tool`** is defined at lines 32-46 in the same module, but delegates to `detect_changes_func` located in [`code_review_graph/tools/review.py`](https://github.com/tirth8205/code-review-graph/blob/main/code_review_graph/tools/review.py) (lines 58-86). This function orchestrates the complex workflow of diff parsing, impact-radius calculation, scoring, and hint generation. Architecturally, `detect_changes_tool` builds upon the same impact-radius engine that `get_impact_radius_tool` exposes, adding the additional layers of analysis.

The VS Code extension utilizes this architecture through the `SqliteReader.getImpactRadius` method in [`code-review-graph-vscode/src/backend/sqlite.ts`](https://github.com/tirth8205/code-review-graph/blob/main/code-review-graph-vscode/src/backend/sqlite.ts) (lines 439-447), demonstrating how the low-level impact-radius logic integrates with UI components.

## Practical Usage Examples

When you need quick impact analysis without overhead:

```python
from code_review_graph import CrgClient

client = CrgClient()
result = client.run(
    "get_impact_radius_tool",
    changed_files=["src/auth.py"],
    max_depth=2,
    detail_level="standard",
)

print("Impacted nodes:", result["impacted_nodes"])
print("Impacted files:", result["impacted_files"])

```

When you need a comprehensive review report:

```python
from code_review_graph import CrgClient

client = CrgClient()
review = client.run(
    "detect_changes_tool",
    include_source=True,
    max_depth=2,
    detail_level="standard",
)

print("Risk score:", review["risk_score"])
print("Top priorities:", review["review_priorities"])
print("Test gaps:", review["test_gaps"])

```

## Summary

- **`get_impact_radius_tool`** provides raw graph traversal to identify the blast radius of changes, suitable for quick impact checks and IDE integrations.
- **`detect_changes_tool`** executes a complete review workflow including diff parsing, risk scoring, and test-gap detection, designed for comprehensive pre-commit analysis.
- Both tools are defined in [`code_review_graph/main.py`](https://github.com/tirth8205/code-review-graph/blob/main/code_review_graph/main.py) but `detect_changes_tool` delegates to `detect_changes_func` in [`code_review_graph/tools/review.py`](https://github.com/tirth8205/code-review-graph/blob/main/code_review_graph/tools/review.py) for complex orchestration.
- The `max_depth` parameter controls traversal depth in both tools, but `detect_changes_tool` applies additional bounds for community impact and test-gap analyses.
- **`detect_changes_tool`** accepts a `base` ref for Git comparison, while **`get_impact_radius_tool`** relies on file lists or auto-detection without deep diff parsing.

## Frequently Asked Questions

### Which tool should I use for quick refactor planning?

Use **`get_impact_radius_tool`** when you need to answer "What else might break if I modify this file?" It provides immediate visibility into the dependency graph neighborhood without the overhead of risk scoring or test analysis, making it ideal for rapid iteration during refactoring sessions.

### Does detect_changes_tool include all functionality of get_impact_radius_tool?

Yes, **`detect_changes_tool`** internally leverages the same impact-radius calculation engine that powers `get_impact_radius_tool`, but adds additional workflow stages including Git diff parsing, risk score computation, and review priority generation. It essentially wraps the raw graph analysis with higher-level review intelligence.

### What are the default depth limits for graph traversal?

Both tools default to `max_depth=2`, which limits the BFS traversal to two hops in the dependency graph. This default prevents exponential explosion in large codebases while capturing the most relevant immediate dependencies. You can increase this value for deeper transitive impact analysis, but be aware that `detect_changes_tool` also uses this parameter to bound other analyses like community impact detection.

### Where is the core logic implemented for these tools?

Both tool wrappers are defined in [`code_review_graph/main.py`](https://github.com/tirth8205/code-review-graph/blob/main/code_review_graph/main.py) (lines 19-27 for `get_impact_radius_tool` and lines 32-46 for `detect_changes_tool`). However, the heavy lifting for `detect_changes_tool` occurs in `detect_changes_func` within [`code_review_graph/tools/review.py`](https://github.com/tirth8205/code-review-graph/blob/main/code_review_graph/tools/review.py) (lines 58-86), which orchestrates the full analysis pipeline.