Bug
In code_review_graph/tools/analysis_tools.py (v2.3.2), five tool functions fail with:
'str' object has no attribute 'resolve'
Affected tools:
get_hub_nodes_func (line 31-32)
get_bridge_nodes_func (line 59-60)
get_knowledge_gaps_func (line 85-86)
get_surprising_connections_func (line 121-122)
get_suggested_questions_func (line 147-148)
Root cause
Each affected function does:
root = _validate_repo_root(repo_root) # repo_root is a str
store = _get_store(str(root))
But _validate_repo_root (in tools/_common.py) is typed as accepting a Path:
def _validate_repo_root(path: Path) -> Path:
resolved = path.resolve() # AttributeError when called with str
The MCP tool signature passes repo_root as a str (the function's own type hint). Calling .resolve() on a string raises AttributeError.
A second issue: _get_store returns a tuple[GraphStore, Path], but the result is assigned to store as if it were a single GraphStore. Subsequent calls like find_hub_nodes(store, top_n=top_n) would receive the whole tuple.
Working pattern (used by all other tool modules)
tools/query.py and other working modules use this single line:
store, root = _get_store(repo_root)
_get_store already wraps repo_root in Path() before validating, and returns the tuple (GraphStore, Path).
Fix
In analysis_tools.py, replace every occurrence of:
root = _validate_repo_root(repo_root)
store = _get_store(str(root))
with:
store, root = _get_store(repo_root)
This fixes all 5 functions and matches the pattern used elsewhere in the package.
Reproduction
Any MCP client invoking mcp__code-review-graph__get_hub_nodes_tool (or any of the other 4 affected tools) hits the error immediately.
Environment
- Package:
code-review-graph==2.3.2
- Python: 3.10
- Installed via:
uvx code-review-graph serve
Bug
In
code_review_graph/tools/analysis_tools.py(v2.3.2), five tool functions fail with:Affected tools:
get_hub_nodes_func(line 31-32)get_bridge_nodes_func(line 59-60)get_knowledge_gaps_func(line 85-86)get_surprising_connections_func(line 121-122)get_suggested_questions_func(line 147-148)Root cause
Each affected function does:
But
_validate_repo_root(intools/_common.py) is typed as accepting aPath:The MCP tool signature passes
repo_rootas astr(the function's own type hint). Calling.resolve()on a string raisesAttributeError.A second issue:
_get_storereturns atuple[GraphStore, Path], but the result is assigned tostoreas if it were a singleGraphStore. Subsequent calls likefind_hub_nodes(store, top_n=top_n)would receive the whole tuple.Working pattern (used by all other tool modules)
tools/query.pyand other working modules use this single line:_get_storealready wrapsrepo_rootinPath()before validating, and returns the tuple(GraphStore, Path).Fix
In
analysis_tools.py, replace every occurrence of:with:
This fixes all 5 functions and matches the pattern used elsewhere in the package.
Reproduction
Any MCP client invoking
mcp__code-review-graph__get_hub_nodes_tool(or any of the other 4 affected tools) hits the error immediately.Environment
code-review-graph==2.3.2uvx code-review-graph serve