MCP Tools Exposed by code-review-graph: Complete Reference for AI Agents

The code-review-graph repository exposes 30 MCP (Model Context Protocol) tools that enable AI agents to query codebases, analyze dependencies, detect changes, and traverse knowledge graphs via JSON-RPC interfaces.

The code-review-graph project provides a comprehensive suite of MCP tools that expose its internal SQLite-based knowledge graph to AI coding assistants. These tools allow agents to perform contextual code reviews, calculate blast radius of changes, and navigate complex software architectures without loading entire repositories into context windows. According to the source documentation in docs/LLM-OPTIMIZED-REFERENCE.md, each tool returns structured JSON payloads with optional context_savings metadata to optimize token usage.

Core Graph Building and Maintenance

The foundation of the knowledge graph relies on two essential tools that handle database creation and index generation.

build_or_update_graph_tool

This tool creates or incrementally updates the SQLite graph database located at .code-review-graph/graph.db. It processes source files to extract nodes and edges representing functions, classes, imports, and test relationships.

run_postprocess_tool

After building the graph, this tool generates derived indexes including flow analysis, community detection structures, and full-text search (FTS5) capabilities that power the higher-level query tools.

Context Discovery and Risk Analysis

These tools provide AI agents with situational awareness about repository changes and their potential impact.

get_minimal_context_tool

Returns a compact summary of the repository including risk scores, top communities, and suggested next tools to invoke. As documented in docs/LLM-OPTIMIZED-REFERENCE.md, this serves as an entry point for agent workflows.

get_impact_radius_tool

Calculates the blast-radius of changed files by traversing graph hops and returning risk-scored dependencies. This helps identify which functions, classes, or tests might be affected by a pull request.

detect_changes_tool

Detects and scores changed functions, classes, and tests within the working directory. Supports detail_level parameters of "minimal" or "standard" to control verbosity.

get_review_context_tool

Retrieves source snippets for specific change sets with configurable depth limits and optional line count restrictions, providing focused context for code review tasks.

get_architecture_overview_tool

Generates high-level summaries of module hierarchies and dependency structures, enabling agents to understand system organization without parsing individual files.

These tools provide flexible interfaces for retrieving specific nodes, edges, and patterns from the knowledge graph.

query_graph_tool

A generic query language supporting operations such as callers_of, callees_of, imports_of, and tests_for. This tool fetches specific nodes and edges based on relationship types defined in the schema.

semantic_search_nodes_tool

Performs keyword or embedding-based searches over graph nodes. According to docs/COMMANDS.md, this tool automatically falls back to FTS5 full-text search when vector embeddings are unavailable.

embed_graph_tool

Computes vector embeddings for all nodes using local or remote providers, enabling similarity searches and semantic clustering across the codebase.

list_graph_stats_tool

Reports high-level repository statistics including node counts, edge counts, and storage size metrics for the SQLite database.

find_large_functions_tool

Identifies files, classes, and functions exceeding configurable line-count thresholds, helping agents locate complex code that may require refactoring attention.

get_docs_section_tool

Returns specific documentation sections such as "usage" or "languages" from the repository's embedded documentation.

Flow Analysis and Critical Path Detection

These tools analyze execution flows and entry points within the codebase.

list_flows_tool

Enumerates high-level flows representing critical paths and entry points throughout the application. Results can be sorted by criticality metrics.

get_flow_tool

Retrieves detailed information about a single identified flow, optionally including source code snippets for nodes within that execution path.

get_affected_flows_tool

Determines which flows are impacted by a specified set of changed files, linking structural changes to runtime behavior implications.

Community Structure Analysis

Tools for understanding modular organization and code cohesion patterns.

list_communities_tool

Lists detected code communities within the graph, including metrics for size and internal cohesion. These communities represent clusters of highly interconnected code elements.

get_community_tool

Retrieves detailed member listings for a named community, showing which functions and classes belong to specific modular groupings.

Architecture Health and Graph Traversal

Advanced utilities for identifying structural risks and navigating complex dependency networks.

get_hub_nodes_tool

Identifies hub nodes with high degree centrality that act as central connectors within the architecture. These nodes represent critical integration points that may carry higher risk during modifications.

get_bridge_nodes_tool

Locates bridge nodes that link otherwise separate sub-graphs or communities. Changes to these nodes can have cascading effects across disconnected modules.

get_knowledge_gaps_tool

Detects missing test coverage or undocumented APIs by analyzing the relationship between implementation nodes and their associated documentation or test edges.

traverse_graph_tool

Provides general BFS (breadth-first search) and DFS (depth-first search) traversal capabilities with token-budget limits, enabling agents to explore neighborhoods around specific nodes without exceeding context window constraints.

Practical Usage Examples

The following JSON examples demonstrate how to invoke these MCP tools according to the specifications in docs/COMMANDS.md.

Retrieving Minimal Context

To obtain a quick repository snapshot with risk assessment and tool recommendations:

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

The response includes risk levels, top communities, and suggested next steps:

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

Calculating Impact Radius

To determine the blast radius of specific file changes:

{
  "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.

To find functions related to authentication using vector similarity:

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

The tool returns the top 5 functions closest to the query embedding, with automatic fallback to full-text search if embeddings are not computed.

Listing Critical Flows

To identify the most critical execution path in the project:

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

Documentation and Source References

The complete signatures and parameter specifications for all 30 MCP tools are maintained in the following documentation files:

Summary

  • code-review-graph exposes 30 MCP tools that serve as JSON-RPC interfaces to its SQLite knowledge graph, enabling AI agents to analyze codebases efficiently.
  • Core tools like build_or_update_graph_tool and run_postprocess_tool handle graph construction and index maintenance.
  • Discovery tools including get_impact_radius_tool and detect_changes_tool provide contextual awareness of repository modifications and their consequences.
  • Query interfaces such as query_graph_tool and semantic_search_nodes_tool support relationship traversal and semantic code search with FTS5 fallback.
  • Flow and community analyzers identify critical paths, architectural hubs, and modular groupings within the code.
  • Documentation in docs/COMMANDS.md and docs/LLM-OPTIMIZED-REFERENCE.md provides authoritative reference material for all tool signatures and parameters.

Frequently Asked Questions

What is the Model Context Protocol (MCP) in code-review-graph?

The Model Context Protocol (MCP) is the standardized interface through which code-review-graph exposes its knowledge graph to AI coding agents. According to docs/architecture.md, each MCP tool is a thin RPC-style function that accepts JSON arguments and returns structured JSON payloads containing graph data, metadata, and context_savings estimates. This protocol allows agents to ask precise questions about code structure without loading entire repositories into their context windows.

How do I query the graph for function dependencies?

Use the query_graph_tool with relationship-specific query types. For example, set query_type to "callers_of" to find functions invoking a specific target, "callees_of" to find functions called by a target, or "imports_of" to trace module dependencies. As documented in docs/COMMANDS.md, this tool supports filtering by node kinds and returns standardized node-edge structures compatible with graph traversal algorithms.

What is the difference between detail_level "minimal" and "standard"?

The detail_level parameter controls payload verbosity across tools like detect_changes_tool and get_review_context_tool. The "minimal" setting returns essential identifiers and scores only, optimizing for token efficiency when agents need quick orientation. The "standard" setting includes full source snippets, complete graph neighborhoods, and comprehensive metadata. According to the source documentation, agents should start with "minimal" to assess scope before potentially requesting "standard" detail for specific areas of interest.

Where are the MCP tool signatures documented?

Complete method signatures, parameter types, default values, and usage examples are documented in docs/COMMANDS.md (lines 24-100) and summarized in docs/LLM-OPTIMIZED-REFERENCE.md (lines 28-30). The AGENTS.md file provides workflow context for how these tools are orchestrated in automated review processes, while code-review-graph-vscode/README.md describes their integration with editor extensions.

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 →