# Codebase-Memory-MCP Tools and Input Schemas: Complete Reference for 15 Built-in Methods

> Explore 15 built-in MCP tools and their input schemas in the codebase-memory-mcp repository. This reference covers repository indexing, graph traversal, ADR management, and more via JSON-RPC 2.0.

- Repository: [Martin Vogel/codebase-memory-mcp](https://github.com/DeusData/codebase-memory-mcp)
- Tags: api-reference
- Published: 2026-07-17

---

**The `codebase-memory-mcp` server exposes 15 built-in MCP tools that accept flat JSON payloads via JSON-RPC 2.0, ranging from repository indexing and graph traversal to ADR management and runtime trace ingestion.**

The `codebase-memory-mcp` repository provides a static-binary MCP server that transforms source code into a queryable knowledge graph. Understanding the **available MCP tools and their input schemas** allows MCP-compatible clients like Claude Code or Cursor to reliably index projects, trace call paths, and manage architecture decisions through structured JSON-RPC requests.

## Available MCP Tools and Their Input Schemas

The server registers all methods in [`src/main.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/main.c) and validates incoming arguments against flat JSON schemas. Each tool accepts a single JSON object where missing optional fields are ignored, and unrecognized keys are discarded.

### Indexing and Project Management

These tools handle repository ingestion and lifecycle operations.

- **`index_repository`**: Indexes a repository into the knowledge graph (creates or updates a project).

  ```json
  { "repo_path": "<absolute-path-to-repo>" }
  ```

- **`list_projects`**: Returns every indexed project together with node and edge counts.

  ```json
  {}
  ```

- **`delete_project`**: Removes a project and all its graph data from the store.

  ```json
  { "project": "<project-name>" }
  ```

- **`index_status`**: Queries the current indexing state (queued, running, finished, error).

  ```json
  { "project": "<project-name>" }
  ```

### Graph Query and Traversal

These tools provide structured and ad-hoc access to the knowledge graph.

- **`search_graph`**: Structured graph search with filtering by label, name pattern, file pattern, degree, and pagination.

  ```json
  {
    "project": "<project>",
    "label": "Function|Class|…",
    "name_pattern": ".*",
    "file_pattern": ".*",
    "min_degree": 0,
    "max_degree": 100,
    "limit": 100,
    "offset": 0
  }
  ```

- **`trace_path`** (alias `trace_call_path`): Breadth-first traversal of the call graph with configurable depth.

  ```json
  {
    "project": "<project>",
    "function_name": "<qualified-name>",
    "direction": "inbound|outbound|both",
    "max_depth": 5
  }
  ```

- **`query_graph`**: Executes read-only Cypher-like queries against the knowledge graph.

  ```json
  {
    "project": "<project>",
    "query": "<Cypher-query-string>"
  }
  ```

- **`get_graph_schema`**: Returns node-label statistics, edge-type definitions, and property schemas.

  ```json
  {}
  ```

### Code Analysis and Retrieval

Use these tools to extract code segments and analyze change impact.

- **`get_code_snippet`**: Retrieves source code for a symbol given its fully-qualified name.

  ```json
  { "project": "<project>", "qualified_name": "<symbol-path>" }
  ```

- **`get_architecture`**: Generates a high-level summary including languages, packages, entry points, HTTP routes, hot spots, and clusters.

  ```json
  { "project": "<project>" }
  ```

- **`search_code`**: Performs text search (grep-style) limited to files belonging to the indexed project.

  ```json
  {
    "project": "<project>",
    "query": "<regex-or-plain-text>",
    "file_pattern": ".*",
    "limit": 100,
    "offset": 0
  }
  ```

- **`detect_changes`**: Maps a `git diff` onto affected symbols and classifies blast-radius risk.

  ```json
  {
    "project": "<project>",
    "diff": "<git-diff-text>",
    "include_untracked": true
  }
  ```

### Architecture and Runtime Management

These tools manage Architecture Decision Records (ADRs) and runtime telemetry.

- **`manage_adr`**: CRUD operations for ADRs stored in the graph.

  ```json
  {
    "project": "<project>",
    "action": "list|create|read|update|delete",
    "adr_id": "<id-optional>",
    "title": "<title-optional>",
    "content": "<markdown-optional>"
  }
  ```

- **`ingest_traces`**: Ingests runtime trace data to validate or enrich `HTTP_CALLS` edges.

  ```json
  {
    "project": "<project>",
    "traces": [
      {
        "source": "<function>",
        "target": "<endpoint>",
        "method": "GET|POST|…",
        "status": 200,
        "latency_ms": 12
      }
    ]
  }
  ```

## Input Schema Validation Rules

All **input schemas** are defined as flat JSON objects. The server implementation in [`src/main.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/main.c) validates the presence of required keys and returns a structured error if mandatory fields are missing. Optional parameters may be omitted entirely without affecting execution. This flat structure ensures compatibility with the MCP specification while simplifying payload construction for client agents.

## CLI Usage Examples

The `codebase-memory-mcp cli` wrapper forwards JSON payloads to the server, simplifying JSON-RPC invocation.

Index a repository using an absolute path:

```bash
codebase-memory-mcp cli index_repository '{"repo_path":"/home/user/my-project"}'

```

List all indexed projects:

```bash
codebase-memory-mcp cli list_projects '{}'

```

Search for functions containing "Handler":

```bash
codebase-memory-mcp cli search_graph \
  '{"project":"my-project","label":"Function","name_pattern":".*Handler.*"}'

```

Trace call chains in both directions with depth 3:

```bash
codebase-memory-mcp cli trace_path \
  '{"project":"my-project","function_name":"my_pkg.my_mod.DoWork","direction":"both","max_depth":3}'

```

Execute a custom Cypher query:

```bash
codebase-memory-mcp cli query_graph \
  '{"project":"my-project","query":"MATCH (f:Function) WHERE NOT EXISTS { (f)<-[:CALLS]-() } RETURN f.name"}'

```

Retrieve architecture overview:

```bash
codebase-memory-mcp cli get_architecture '{"project":"my-project"}'

```

Search source code for TODO markers:

```bash
codebase-memory-mcp cli search_code \
  '{"project":"my-project","query":"TODO","file_pattern":"*.go"}'

```

Create a new Architecture Decision Record:

```bash
codebase-memory-mcp cli manage_adr \
  '{"project":"my-project","action":"create","title":"Use CBM for indexing","content":"..."}'

```

## Source Code References

The **MCP tools** are implemented and documented in the following locations:

- **[`src/main.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/main.c)**: Registers the 15 JSON-RPC methods and implements the dispatch logic that validates incoming payloads.
- **[`README.md`](https://github.com/DeusData/codebase-memory-mcp/blob/main/README.md)** (lines 37–78): Contains the complete tool table and schema definitions referenced in this guide.
- **[`docs/CONFIGURATION.md`](https://github.com/DeusData/codebase-memory-mcp/blob/main/docs/CONFIGURATION.md)**: Documents server configuration and environment variables affecting tool behavior.
- **`internal/cbm/*`** (e.g., [`zstd_store.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/zstd_store.c)): Core indexing pipeline that populates the graph data queried by these tools.
- **[`tests/test_mcp.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/tests/test_mcp.c)**: Unit tests verifying argument handling and schema validation for each tool.

## Summary

- **`codebase-memory-mcp`** exposes **15 MCP tools** via JSON-RPC 2.0 for comprehensive codebase analysis.
- All tools expect **flat JSON input schemas** with required fields strictly validated in [`src/main.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/main.c).
- **Indexing tools** (`index_repository`, `list_projects`, `delete_project`, `index_status`) manage the knowledge graph lifecycle.
- **Traversal tools** (`search_graph`, `trace_path`, `query_graph`) provide both structured filtering and custom Cypher access.
- **Analysis tools** (`detect_changes`, `get_architecture`, `search_code`) support impact analysis and code retrieval.
- **Management tools** (`manage_adr`, `ingest_traces`) support architectural documentation and runtime correlation.

## Frequently Asked Questions

### How do I validate the JSON input before sending it to the MCP server?

The server validates all incoming payloads against expected keys in [`src/main.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/main.c). Ensure your JSON object includes all required fields listed in the schema tables above; optional fields may be omitted. If validation fails, the server returns a structured error indicating the missing parameter.

### What is the difference between `search_graph` and `query_graph`?

**`search_graph`** provides a structured interface with specific filter parameters like `label`, `name_pattern`, and `min_degree`, making it ideal for targeted symbol discovery. **`query_graph`** accepts raw Cypher-like strings in the `query` field, offering full flexibility for complex graph traversals but requiring knowledge of the graph schema.

### Can I use `trace_path` to analyze both incoming and outgoing call chains?

Yes. The `direction` parameter accepts three values: `"inbound"` for callers, `"outbound"` for callees, and `"both"` to traverse the complete call graph bidirectionally up to the specified `max_depth`.

### Where are the MCP tool schemas documented in the repository?

The authoritative schema definitions reside in the **MCP Tools** section of [`README.md`](https://github.com/DeusData/codebase-memory-mcp/blob/main/README.md) (lines 37–78). Implementation details, including argument parsing and validation logic, are found in [`src/main.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/main.c), while configuration options are detailed in [`docs/CONFIGURATION.md`](https://github.com/DeusData/codebase-memory-mcp/blob/main/docs/CONFIGURATION.md).