# Available MCP Tools and Their Use Cases in code-review-graph

> Explore 30+ MCP tools in code-review-graph for AI code review, debugging, and refactoring. Enhance workflows with structural knowledge graphs.

- Repository: [Tirth Kanani/code-review-graph](https://github.com/tirth8205/code-review-graph)
- Tags: api-reference
- Published: 2026-08-18

---

**The code-review-graph project provides 30+ Model-Context-Protocol (MCP) tools that expose a structural knowledge graph to AI-assisted coding tools, enabling token-efficient code review, debugging, and refactoring workflows.**

The **code-review-graph** repository by tirth8205 implements a sophisticated MCP server that bridges AI assistants with a SQLite-backed knowledge graph of your codebase. Each MCP tool accepts a JSON payload, executes a focused query, and returns results with optional `context_savings` estimates to help agents minimize token usage. This guide covers every available tool grouped by functional area, with exact source references from [`docs/COMMANDS.md`](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md) and practical invocation examples.

## Core Graph Operations

These tools manage the lifecycle of the knowledge graph itself.

### build_or_update_graph_tool

Creates a new graph or incrementally updates an existing one. Use this after significant code changes or when initializing a fresh repository analysis. Defined at [docs/COMMANDS.md#L28-L35](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L28-L35).

### run_postprocess_tool

Re-executes downstream analyses including flow detection, community detection, and full-text search indexing. Typically invoked immediately after `build_or_update_graph_tool` to refresh derived artifacts. Found at [docs/COMMANDS.md#L37-L44](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L37-L44).

### list_graph_stats_tool

Reports basic health metrics: node count, edge count, and storage size. Ideal for verifying graph integrity before expensive operations. Located at [docs/COMMANDS.md#L12-L16](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L12-L16).

### embed_graph_tool

Generates vector embeddings for semantic search capabilities. Required prerequisite for using `semantic_search_nodes_tool` with local or remote embedding providers. See [docs/COMMANDS.md#L104-L110](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L104-L110).

## Context Extraction Tools

These MCP tools minimize token usage by returning only relevant code context.

### get_minimal_context_tool

Returns the minimal file set needed for a specific task (e.g., "run tests" or "deploy service"). Accelerates CI pipelines and AI-driven commands by excluding irrelevant files. Defined at [docs/COMMANDS.md#L45-L51](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L45-L51).

### get_review_context_tool

Fetches source snippets for changed files up to a configurable depth. Purpose-built for pre-commit review bots that need targeted code inspection. Found at [docs/COMMANDS.md#L72-L81](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L72-L81).

### get_impact_radius_tool

Computes the blast radius (in graph hops) of a change set. Review pipelines use this to identify high-risk areas requiring human attention. Located at [docs/COMMANDS.md#L53-L60](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L53-L60).

### get_architecture_overview_tool

Produces high-level architecture diagrams with configurable detail. Compact mode suits onboarding; expanded mode aids documentation generation. See [docs/COMMANDS.md#L75-L80](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L75-L80).

## Graph Query Tools

General-purpose inspection and search capabilities.

### query_graph_tool

The workhorse for custom inspections. Supports patterns like `callers_of`, `imports_of`, and `tests_for`. Found at [docs/COMMANDS.md#L63-L70](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L63-L70).

### semantic_search_nodes_tool

Vector-based similarity search across functions, classes, and files. Best for "find similar implementations" queries. Requires prior execution of `embed_graph_tool`. Defined at [docs/COMMANDS.md#L93-L102](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L93-L102).

### traverse_graph_tool

Breadth-first or depth-first traversal from an arbitrary query string. Useful for exploratory analysis without crafting full `query_graph_tool` patterns. Located at [docs/COMMANDS.md#L84-L92](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L84-L92).

### find_large_functions_tool

Detects functions, classes, or files exceeding a line-count threshold. Refactoring workflows use this to identify decomposition candidates. See [docs/COMMANDS.md#L17-L24](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L17-L24).

### get_docs_section_tool

Retrieves specific documentation sections (usage, troubleshooting, architecture). Enables AI agents to surface help text on demand. Found at [docs/COMMANDS.md#L26-L30](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L26-L30).

## Flow-Analysis Tools

Execution path inspection for understanding critical call chains.

### list_flows_tool

Lists top-ranked execution flows sorted by criticality, depth, or frequency. Surfaces the most important call chains for review. Defined at [docs/COMMANDS.md#L31-L40](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L31-L40).

### get_flow_tool

Returns detailed steps for a single flow, optionally including source code. Ideal for step-by-step debugging sessions. Located at [docs/COMMANDS.md#L42-L48](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L42-L48).

### get_affected_flows_tool

Maps changed files to the execution flows they touch. Critical for impact analysis in PR reviews. See [docs/COMMANDS.md#L50-L56](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L50-L56).

## Community-Analysis Tools

Logical code clustering and architectural insight.

### list_communities_tool

Enumerates code "communities" (graph clusters) sorted by size or cohesion. Provides high-level architectural visibility. Found at [docs/COMMANDS.md#L58-L64](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L58-L64).

### get_community_tool

Details a specific community, optionally listing its member nodes. Use when drilling into a particular subsystem. Defined at [docs/COMMANDS.md#L66-L73](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L66-L73).

### get_hub_nodes_tool and get_bridge_nodes_tool

- **get_hub_nodes_tool**: Identifies central nodes with high connectivity—your "core" modules.
- **get_bridge_nodes_tool**: Finds nodes that connect otherwise separate communities—potential coupling hotspots.

Both located at [docs/COMMANDS.md#L84-L94](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L84-L94).

### get_knowledge_gaps_tool

Detects missing documentation or uncovered test cases. Supports continuous quality improvement workflows. Found at [docs/COMMANDS.md#L96-L100](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L96-L100).

### get_surprising_connections_tool

Highlights unexpected cross-module edges. Uncovers hidden dependencies that may violate architectural boundaries. Located at [docs/COMMANDS.md#L102-L105](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L102-L105).

### get_suggested_questions_tool

Auto-generates exploratory questions about the codebase (e.g., "What modules use X?"). Chat-based assistants use this to steer productive conversations. See [docs/COMMANDS.md#L107-L110](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L107-L110).

## Change-Analysis and Refactoring Tools

Safe, automated code transformation.

### detect_changes_tool

The primary review tool: maps changed files to affected functions, flows, communities, and test gaps, returning computed risk scores. Essential for pre-commit and PR review pipelines. Defined at [docs/COMMANDS.md#L13-L22](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L13-L22).

### refactor_tool

Supports rename operations, dead-code detection, and suggestion modes. Acts as a safe-first analysis before any transformation. Located at [docs/COMMANDS.md#L26-L34](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L26-L34).

### apply_refactor_tool

Applies a previously-generated refactor plan with optional dry-run. Ensures automated but reversible changes. Found at [docs/COMMANDS.md#L36-L42](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L36-L42).

## Wiki Generation Tools

Automated documentation from graph structure.

### generate_wiki_tool

Creates a markdown wiki from discovered communities and flows. Convenient for keeping documentation synchronized with code. Defined at [docs/COMMANDS.md#L44-L50](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L44-L50).

### get_wiki_page_tool

Fetches a pre-generated wiki page for a specific community. Allows AI agents to surface documentation on demand. Located at [docs/COMMANDS.md#L52-L55](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L52-L55).

## Multi-Repository Tools

Cross-project analysis capabilities.

### list_repos_tool

Lists all repositories registered with the multi-repo daemon. Used by agents operating across multiple projects. Found at [docs/COMMANDS.md#L58-L62](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L58-L62).

### cross_repo_search_tool

Executes semantic or textual search across all registered repositories. Ideal for identifying code reuse or duplicated logic across projects. See [docs/COMMANDS.md#L64-L70](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md#L64-L70).

## Practical MCP Tool Invocation Examples

The `mcp client` (provided by `code-review-graph serve`) expects payloads of the form `{ "tool": "<tool_name>", "params": { … } }`. Send these via `curl`, the built-in `mcp` CLI, or any MCP-compatible client such as Claude Code or GitHub Copilot Chat.

### Detect Changes with Risk Scoring

```json
{
  "tool": "detect_changes_tool",
  "params": {
    "base": "HEAD~1",
    "include_source": true,
    "max_depth": 2
  }
}

```

### Query Graph for Function Callers

```json
{
  "tool": "query_graph_tool",
  "params": {
    "pattern": "callers_of",
    "target": "my_pkg.my_module.my_function",
    "detail_level": "standard"
  }
}

```

### Semantic Search for Similar Functions

```json
{
  "tool": "semantic_search_nodes_tool",
  "params": {
    "query": "parse CSV file",
    "kind": "Function",
    "limit": 5,
    "provider": "local"
  }
}

```

### Compact Architecture Overview

```json
{
  "tool": "get_architecture_overview_tool",
  "params": {
    "detail_level": "minimal"
  }
}

```

### Safe Symbol Rename

```json
{
  "tool": "refactor_tool",
  "params": {
    "mode": "rename",
    "old_name": "old_func",
    "new_name": "new_func"
  }
}

```

## Key Reference Files

| File | Purpose |
|------|---------|
| [`docs/COMMANDS.md`](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md) | Complete catalog of all MCP tools with parameter schemas. [[link]](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md) |
| [`docs/architecture.md`](https://github.com/tirth8205/code-review-graph/blob/main/docs/architecture.md) | High-level description of graph structure, MCP server, and client integration. [[link]](https://github.com/tirth8205/code-review-graph/blob/main/docs/architecture.md) |
| [`code_review_graph/docs/LLM-OPTIMIZED-REFERENCE.md`](https://github.com/tirth8205/code-review-graph/blob/main/code_review_graph/docs/LLM-OPTIMIZED-REFERENCE.md) | Concise reference listing 30 core MCP tools and 5 MCP prompts for LLM-aware agents. [[link]](https://github.com/tirth8205/code-review-graph/blob/main/code_review_graph/docs/LLM-OPTIMIZED-REFERENCE.md) |
| [`docs/USAGE.md`](https://github.com/tirth8205/code-review-graph/blob/main/docs/USAGE.md) | Practical installation, configuration, and invocation guide. [[link]](https://github.com/tirth8205/code-review-graph/blob/main/docs/USAGE.md) |

## Summary

- **30+ MCP tools** cover graph operations, context extraction, queries, flow analysis, community detection, refactoring, wiki generation, and multi-repo search
- **Token efficiency**: Every tool returns `context_savings` estimates to minimize LLM token usage
- **Exact source locations**: All tool definitions reside in [`docs/COMMANDS.md`](https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md) with precise line number references
- **Practical integration**: JSON payloads work with `curl`, the `mcp` CLI, Claude Code, GitHub Copilot Chat, and other MCP-compatible clients
- **AI-first design**: Tools like `get_suggested_questions_tool` and `detect_changes_tool` anticipate autonomous agent workflows

## Frequently Asked Questions

### How do I invoke MCP tools from the command line?

Start the MCP server with `code-review-graph serve`, then send JSON payloads via the built-in `mcp` CLI or any HTTP client. The server accepts POST requests with tool name and parameters, returning structured results suitable for piping to other tools or parsing by AI agents.

### What is the difference between query_graph_tool and semantic_search_nodes_tool?

`query_graph_tool` executes deterministic graph traversals using patterns like `callers_of` or `imports_of`—ideal for precise structural queries. `semantic_search_nodes_tool` performs vector similarity search over embeddings, better suited for fuzzy "find similar code" scenarios where you don't know exact names or structures.

### Do I need to run embed_graph_tool before using semantic search?

Yes. `embed_graph_tool` generates the vector embeddings required by `semantic_search_nodes_tool`. Without this preprocessing step, semantic search will return empty results or errors depending on your embedding provider configuration.

### Which MCP tool should I use for automated PR reviews?

Start with `detect_changes_tool` as your primary entry point—it provides risk-scored analysis of what changed and why it matters. Supplement with `get_review_context_tool` for source snippets and `get_affected_flows_tool` to understand execution impact.