Complete Guide to the 30 MCP Tools in code-review-graph: Functions and Usage

The code-review-graph repository exposes 30 MCP (Model Context Protocol) tools that enable AI coding agents to query a SQLite-backed knowledge graph for code review, dependency analysis, and architectural discovery without loading the entire codebase.

The code-review-graph open-source project by tirth8205 ships a comprehensive suite of 30 MCP tools designed to bridge AI agents with static code analysis. These JSON-RPC style functions expose graph traversals, semantic searches, and impact calculations maintained in a local SQLite database, allowing precise interrogation of codebase structure and change impact. Each tool returns structured JSON payloads with optional context_savings metadata to help callers estimate token efficiency.

Core Graph-Building and Post-Processing Tools

These foundational tools initialize and maintain the knowledge graph stored in .code-review-graph/graph.db.

build_or_update_graph_tool

Creates or incrementally updates the SQLite graph database. This tool parses the repository to extract nodes (functions, classes, files) and edges (calls, imports, inheritance), persisting them for downstream analysis.

run_postprocess_tool

Generates derived indexes after a graph build, including flow detection, community clustering, and full-text search (FTS5) indexes. This post-processing step is required to enable the advanced query capabilities used by other MCP tools.

Context Discovery Tools

These tools provide high-level situational awareness for code review tasks, calculating risk scores and blast radii for changes.

get_minimal_context_tool

Returns a compact summary of the repository state, including a risk score, top communities, and suggested next tools to invoke. Ideal for initializing an AI agent session with minimal token expenditure.

get_impact_radius_tool

Calculates the blast radius of changed files by traversing graph hops outward from modified nodes. Returns impacted nodes with risk scores, bounded by configurable depth limits.

get_review_context_tool

Retrieves source code snippets relevant to a specific change set. Supports bounded depth traversal and optional line limits to keep responses within token budgets.

detect_changes_tool

Detects and scores changed functions, classes, and tests within a pull request. Supports detail_level="minimal" for quick scanning or "standard" for comprehensive analysis.

get_architecture_overview_tool

Summarizes the overall system architecture, including module hierarchy and high-level dependencies. Useful for onboarding AI agents to unfamiliar codebases.

Graph Query and Search Tools

These tools provide flexible access to the underlying graph data and vector embeddings.

query_graph_tool

Generic query interface supporting predicates such as callers_of, callees_of, imports_of, and tests_for. Returns nodes and edges matching the specified relationship patterns.

semantic_search_nodes_tool

Performs keyword or embedding-based search over graph nodes. Automatically falls back to FTS5 full-text search when vector embeddings are unavailable or when using local providers without GPU acceleration.

embed_graph_tool

Computes vector embeddings for all nodes using local or remote providers (e.g., OpenAI, Ollama). These embeddings power semantic similarity searches and clustering algorithms.

list_graph_stats_tool

Reports high-level repository statistics including node count, edge count, and storage size of the SQLite database. Useful for monitoring graph health and indexing completion.

find_large_functions_tool

Lists files, classes, and functions exceeding a configurable line-count threshold. Helps identify refactoring candidates and potential complexity hotspots.

get_docs_section_tool

Returns specific sections from the project documentation (e.g., "usage", "languages", "configuration"). Enables AI agents to reference human-written docs without file system access.

Flow Analysis Tools

These tools trace execution paths and critical paths through the codebase.

list_flows_tool

Enumerates high-level flows representing critical execution paths and entry points. Supports sorting by criticality, size, or alphabetical order.

get_flow_tool

Retrieves detailed information about a single flow by name, including the path of nodes and optional source code snippets for each step in the execution chain.

get_affected_flows_tool

Identifies which execution flows are impacted by a given set of changed files. Essential for determining which integration tests to run after a modification.

Community Detection Tools

These tools expose graph clustering results that reveal modular boundaries and coupling.

list_communities_tool

Lists detected code communities (clusters) with metrics for size and internal cohesion. Communities represent groups of nodes with dense internal connectivity.

get_community_tool

Returns detailed membership lists for a specific named community, including entry points and external dependencies crossing community boundaries.

Architecture Health and Structural Analysis

These tools identify structural patterns and quality gaps in the codebase.

get_hub_nodes_tool

Finds hub nodes with high degree centrality—components that act as central connectors between otherwise disparate subsystems. Changes to hubs carry higher regression risk.

get_bridge_nodes_tool

Identifies bridge nodes that link separate sub-graphs or communities. These articulation points represent critical dependencies where failures could fragment the system.

get_knowledge_gaps_tool

Detects missing test coverage or undocumented APIs by analyzing nodes with no incoming test edges or lacking documentation references.

Graph Traversal Utilities

traverse_graph_tool

General-purpose BFS/DFS traversal with token-budget limits and cycle detection. Supports custom filtering predicates and depth constraints for exploratory analysis.

Practical Usage Examples

The following JSON payloads demonstrate how to invoke these MCP tools against the code-review-graph server.

Retrieve Minimal Context for Review

{
  "tool": "get_minimal_context_tool",
  "args": { "task": "review changes" }
}

Typical response:

{
  "risk": "low",
  "top_communities": ["utils", "core"],
  "suggested_next_tools": ["detect_changes_tool", "get_impact_radius_tool"],
  "context_savings": 120
}

Reference: docs/LLM-OPTIMIZED-REFERENCE.md lines 10-12

Calculate Change Impact Radius

{
  "tool": "get_impact_radius_tool",
  "args": {
    "changed_files": ["src/api.py", "src/models/user.py"],
    "max_depth": 2,
    "detail_level": "standard"
  }
}

This returns a table of impacted nodes with associated risk scores and estimated token savings.

Reference: docs/COMMANDS.md lines 53-60

Semantic Search for Authentication Logic

{
  "tool": "semantic_search_nodes_tool",
  "args": {
    "query": "authentication",
    "kind": "Function",
    "limit": 5,
    "detail_level": "minimal"
  }
}

Returns the top 5 functions whose embeddings are closest to the query vector, falling back to full-text search if embeddings are not computed.

Reference: docs/COMMANDS.md lines 93-100

List Critical Execution Flows

{
  "tool": "list_flows_tool",
  "args": {
    "sort_by": "criticality",
    "limit": 1,
    "detail_level": "standard"
  }
}

Response includes the flow name, entry-point node identifier, and path description.

Reference: docs/COMMANDS.md lines 31-40

Summary

  • code-review-graph provides 30 MCP tools organized into seven functional categories: graph construction, context discovery, semantic search, flow analysis, community detection, architecture health, and general traversal.
  • All tools return JSON payloads with optional context_savings metadata to optimize token usage in AI agent conversations.
  • Tool signatures and complete parameter specifications are documented in docs/COMMANDS.md, while high-level usage patterns are described in docs/LLM-OPTIMIZED-REFERENCE.md.
  • The graph is stored in a local SQLite file (.code-review-graph/graph.db) and maintains nodes for functions, classes, and files with edges representing calls, imports, and test relationships.
  • Tools like get_impact_radius_tool and get_affected_flows_tool enable precise change-set analysis without requiring the AI agent to parse raw source code.

Frequently Asked Questions

What is the difference between query_graph_tool and semantic_search_nodes_tool?

query_graph_tool performs exact structural queries based on graph relationships (callers, callees, imports) using the relational schema, while semantic_search_nodes_tool uses vector embeddings or FTS5 to find nodes conceptually related to a natural language query. Use the former when you know the specific dependency pattern; use the latter for discovery tasks where you only have a descriptive keyword like "authentication" or "billing."

How does code-review-graph handle token limits when returning large graphs?

Most tools accept a detail_level parameter ("minimal" or "standard") and limit arguments to constrain result sets. Additionally, the traverse_graph_tool implements token-budget-aware BFS/DFS traversal that halts expansion when the estimated response size exceeds the specified budget, returning a partial result set with a continuation marker.

Where are the MCP tool definitions registered in the source code?

The complete inventory of all 30 MCP tools and their JSON schemas is documented in docs/LLM-OPTIMIZED-REFERENCE.md (lines 28-30) and docs/COMMANDS.md (lines 24-100). The runtime registration occurs within the MCP server implementation, which binds each tool name to its corresponding handler function that queries the SQLite graph database.

Can I use these tools without the VS Code extension?

Yes. While code-review-graph-vscode/README.md describes the VS Code integration, the MCP tools are exposed via standard JSON-RPC over stdio or HTTP. You can invoke them from any MCP-compatible client, including Claude Desktop, Cursor, or custom Python scripts using the mcp SDK, provided the code-review-graph server binary is running and pointed at a valid .code-review-graph/graph.db file.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →