Complete Guide to MCP Tools in code-review-graph: 30 AI-Powered Code Analysis Instruments
The tirth8205/code-review-graph repository provides approximately 30 Model-Centric Programming (MCP) tools organized into three categories—Core Tools for graph construction and querying, Flow Tools for execution path analysis, and Community Tools for architectural subsystem insights—enabling comprehensive AI-assisted code review and refactoring.
The tirth8205/code-review-graph project ships a comprehensive suite of MCP (Model-Centric Programming) tools designed to power AI-assisted code analysis workflows. These tools enable automated graph navigation, impact analysis, and intelligent refactoring by exposing the codebase structure through a structured Model Context Protocol interface. According to the source code in code_review_graph/skills.py and the command reference in docs/COMMANDS.md, the tools are logically grouped into three distinct categories that cover the full graph lifecycle.
Core Tools: Graph Construction and Analysis
Core Tools form the foundation for any AI-driven workflow, providing capabilities to build, query, and retrieve information from the knowledge graph. These instruments handle raw graph data, impact analysis, and minimal context extraction.
The 12 primary Core Tools include:
build_or_update_graph_tool– Constructs or incrementally updates the knowledge graph from source code.run_postprocess_tool– Executes post-processing operations on the graph to enrich relationships and metadata.get_minimal_context_tool– Extracts the smallest viable context necessary for specific queries, optimizing token usage.get_impact_radius_tool– Analyzes the blast radius of proposed changes by tracing dependencies and affected nodes.query_graph_tool– Executes structured queries against the graph database using flexible search parameters.get_review_context_tool– Gathers comprehensive context specifically formatted for automated code review scenarios.traverse_graph_tool– Navigates graph paths to discover connections between functions, classes, and modules.semantic_search_nodes_tool– Performs vector-based semantic searches across graph nodes to find conceptually related code.embed_graph_tool– Generates and manages vector embeddings for graph entities to enable similarity comparisons.list_graph_stats_tool– Reports statistical metrics about graph size, density, and node distribution.find_large_functions_tool– Identifies functions exceeding complexity or line-count thresholds for refactoring targets.get_docs_section_tool– Retrieves specific documentation sections associated with code entities.
Flow Tools: Execution Path Analysis
Flow Tools operate on flows—high-level execution paths extracted from the graph, such as request-handling pipelines or build pipelines. These three tools let you list, inspect, and fetch the flows most critical for a given change.
list_flows_tool– Enumerates available execution flows within the codebase, sortable by criticality or complexity.get_flow_tool– Retrieves detailed information about a specific execution flow, including constituent nodes and edges.get_affected_flows_tool– Identifies which execution paths intersect with modified files or functions, highlighting critical test paths.
Community Tools: Architecture and Subsystem Insights
Community Tools work with communities—clusters of related nodes (functions, classes, tests) that form logical subsystems. These eight tools help explore cohesion, size, and membership of architectural communities.
list_communities_tool– Displays all detected communities within the graph, showing size and cohesion metrics.get_community_tool– Provides detailed membership and boundary information for a specific community.get_architecture_overview_tool– Generates high-level architectural summaries, available in varying detail levels from minimal to comprehensive.get_hub_nodes_tool– Identifies central hub nodes that connect multiple communities or have high centrality scores.get_bridge_nodes_tool– Finds bridge nodes that link otherwise disconnected communities, highlighting critical integration points.get_knowledge_gaps_tool– Detects areas of the codebase with sparse documentation or test coverage within communities.get_surprising_connections_tool– Reveals unexpected dependencies or couplings between seemingly unrelated components.get_suggested_questions_tool– Generates intelligent questions about the architecture to guide human reviewers or LLM analysis.
Practical Implementation Examples
The MCP server (code-review-graph serve) expects JSON payloads containing the tool name and arguments. Below are implementation patterns for each category.
Core Tool: Impact Radius Analysis
Invoke get_impact_radius_tool to assess change impact before committing:
import json
import subprocess
payload = {
"tool": "get_impact_radius_tool",
"args": {
"changed_files": None, # auto-detect from VCS
"max_depth": 3,
"detail_level": "standard"
}
}
result = subprocess.run(
["code-review-graph", "mcp"],
input=json.dumps(payload).encode(),
capture_output=True,
text=True
)
impact_data = json.loads(result.stdout)
print(f"Affected nodes: {len(impact_data['nodes'])}")
Flow Tool: Critical Flow Enumeration
Retrieve the ten most critical execution paths using list_flows_tool:
payload = {
"tool": "list_flows_tool",
"args": {
"sort_by": "criticality",
"limit": 10
}
}
# Execute via subprocess or direct MCP client connection
Community Tool: Architecture Overview
Generate a minimal architecture summary with get_architecture_overview_tool:
payload = {
"tool": "get_architecture_overview_tool",
"args": {
"detail_level": "minimal"
}
}
Source Code Reference
The MCP tool implementations and signatures are defined across these key files:
docs/COMMANDS.md– Central catalog documenting all 30+ MCP tools with complete signatures, default parameters, and usage notes.code_review_graph/skills.py– Python skill wrappers that expose the tools to the LLM server and handle argument validation.tests/test_tools.py– Comprehensive test suite validating each tool's argument handling, output format, and error conditions.README.md– High-level project overview including server startup and MCP protocol configuration.
Summary
- The code-review-graph repository organizes approximately 30 MCP tools into three functional groups: Core, Flow, and Community.
- Core Tools handle graph construction, semantic search, and impact analysis through instruments like
build_or_update_graph_toolandget_impact_radius_tool. - Flow Tools focus on execution path analysis via
list_flows_tool,get_flow_tool, andget_affected_flows_tool. - Community Tools expose architectural insights through
get_architecture_overview_tool,get_hub_nodes_tool, andget_knowledge_gaps_tool. - All tools are implemented in
code_review_graph/skills.pyand documented indocs/COMMANDS.md, accepting JSON payloads via the MCP server interface.
Frequently Asked Questions
What are MCP tools in the context of code-review-graph?
MCP tools (Model-Centric Programming tools) in the tirth8205/code-review-graph repository are specialized functions that expose code analysis capabilities through the Model Context Protocol. They allow AI systems and automated agents to query knowledge graphs, analyze execution flows, and inspect architectural communities without directly manipulating the underlying graph database.
How do I invoke these MCP tools programmatically?
You can invoke MCP tools by sending JSON payloads to the MCP server via the CLI command code-review-graph mcp or through direct integration with the Python skills defined in code_review_graph/skills.py. Each payload must specify the tool name and an args dictionary containing the required parameters for that specific instrument.
What is the difference between Flow Tools and Community Tools?
Flow Tools analyze execution paths—dynamic sequences of function calls that represent runtime behavior, such as API request handling. Community Tools analyze static clusters—groups of related code entities that form logical subsystems or modules. Flows show how code runs; communities show how code is organized.
Where are the MCP tool implementations defined in the source code?
The concrete implementations are located in code_review_graph/skills.py, while the command specifications and parameter schemas are documented in docs/COMMANDS.md. The test suite in tests/test_tools.py provides additional examples of expected inputs and outputs for each tool category.
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:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →