analyze_codebase
Ingest a C++ codebase and build its dependency graph.
This tool does NOT accept 'code_content'. Provide exactly ONE of:
repo_url, raw_files, or directory_path.
- repo_url: an HTTPS GitHub URL (e.g. 'https://github.com/user/repo').
Optionally add patch_content (a unified diff string) to overlay
uncommitted changes on the cloned repo.
- raw_files: for hobby projects or small codebases NOT hosted on GitHub.
The user pastes their C++ code directly and you wrap each file into a
JSON array of objects with 'filename' and 'content' keys. Example:
[
{"filename": "main.cpp", "content": "void main() { helper(); }"},
{"filename": "utils.cpp", "content": "void helper() {}"}
]
- directory_path: absolute local filesystem path (local mode only;
rejected when the server runs in cloud mode).
Args:
repo_url: HTTPS URL of a git repository to clone.
patch_content: Unified diff to apply after cloning repo_url.
raw_files: List of dicts [{"filename": str, "content": str}].
Use this when the user shares code snippets directly
and does not have a git repository.
directory_path: Local path to scan (local mode only).
Returns:
Status message with file count and function count.
get_file_functions
List all functions defined in a specific source file.
Use the relative path exactly as returned in the analyze_codebase
output (e.g., 'src/engine.cpp' or 'main.cpp').
Args:
filepath: Relative path of the source file within the analyzed workspace.
Returns:
A newline-separated list of function names, or no-match message.
get_file_coupling
Generate a report showing which files depend on which other files.
Aggregates cross-file function calls into a per-file-pair summary
(e.g., 'src/main.cpp -> src/utils.cpp (3 calls)').
Returns:
A formatted coupling report, or a message if no cross-file deps exist.
get_callers
List upstream functions that call the given function.
Args:
function_name: Exact name of the function (e.g., 'calculate_interest').
Returns:
Comma-separated list of caller function names.
get_callees
List downstream functions that are called by the given function.
Args:
function_name: Exact name of the function (e.g., 'process_client').
Returns:
Comma-separated list of callee function names.
detect_cycles
Detect circular dependencies in the current call graph.
Returns:
Formatted list of cycles, or a message if none found.
get_orphan_functions
Identify functions that are defined but never called by any other function.
Returns:
Comma-separated list of orphan function names.
generate_mermaid_graph
Generate a Mermaid.js dependency diagram and return it as a markdown string.
The AI can render this diagram inline in the chat. For large graphs,
use focus_node and max_depth to keep the output token-efficient.
Args:
focus_node: Optional function name to centre the graph on.
max_depth: Max hops from focus_node (default 2).
Returns:
A Mermaid-fenced markdown string for inline rendering.