restrict tools to scope for cost savings on large repo#7
Conversation
khezen
left a comment
There was a problem hiding this comment.
🔍 CodeSpy Review
Issues Found: 0 | Critical: 0 | High: 0 | Medium: 0
📋 Summary
Restricts MCP filesystem/parser tools to scope subroot directories instead of the full repository root, reducing token consumption and cost on large monorepos. Adds helper functions for path translation between repo-relative and scope-relative coordinates, and restructures both reviewers to create/destroy tool contexts per-scope rather than once globally.
🎯 Quality Assessment
Well-structured. Clean separation of concerns: path utilities extracted to helpers, scope-restriction logic consistent across both reviewer modules. Proper resource cleanup with per-scope finally blocks. Edge cases handled ("." subroot passthrough). OSV tools correctly shared since they have no filesystem dependency. The categories input field addition is a good decoupling.
📊 Statistics
| Metric | Count |
|---|---|
| Total Issues | 0 |
| Critical | 0 |
| High | 0 |
| Medium | 0 |
| Low | 0 |
| Security | 0 |
| Bugs | 0 |
| Documentation | 0 |
💰 Cost Summary
Total: $0.9618 | Tokens: 125,791 | LLM Calls: 11
| Signature | Cost | Tokens | Calls | Duration |
|---|---|---|---|---|
| code_and_doc_review | $0.7416 | 70,559 | 3 | 229.7s |
| scope_identification | $0.1560 | 45,585 | 7 | 67.1s |
| summarization | $0.0642 | 9,647 | 1 | 18.0s |
💡 Recommendation
APPROVE — Correct implementation of scope-restricted tooling. No defects found. Pattern is consistent across both modules, path handling covers edge cases, and resource cleanup is properly scoped.
this PR aims to reduce costs on large repo by restricting MCP servers to the sub scope being reviewed.