Code Memory
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| EMBEDDING_MODEL | No | HuggingFace model ID for embeddings | jinaai/jina-code-embeddings-0.5b |
| CODE_MEMORY_LOG_LEVEL | No | Logging verbosity (DEBUG, INFO, WARNING, ERROR) | INFO |
Capabilities
Features and capabilities supported by this server
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| check_index_statusA | USE THIS TOOL to check if the codebase has been indexed and whether search tools will return results. Call this BEFORE search_code or search_docs if you're unsure about indexing state. TRIGGER - Call this tool when:
This tool checks the SQLite database for indexed symbols and documentation chunks. It's a lightweight diagnostic - much faster than re-indexing. INTERPRETING RESULTS:
Do NOT use this tool for:
Args: directory: Path to the project directory to check. Returns: Dictionary with: - indexed: boolean - true if anything has been indexed - symbols_indexed: count of code symbols in index - doc_chunks_indexed: count of documentation chunks - code_files_indexed: count of indexed code files - doc_files_indexed: count of indexed doc files - suggestion: "ready to search" or "CALL index_codebase FIRST" |
| get_index_statsA | USE THIS TOOL to get comprehensive statistics about the code index. This tool provides detailed metrics about the index health, including file counts, symbol distributions, embedding model info, and database size. TRIGGER - Call this tool when:
Do NOT use this tool for:
Args: directory: Path to the project directory. Returns: Dictionary with: - indexed: boolean - true if anything has been indexed - counts: Symbol, file, chunk, and embedding counts - distributions: Symbol kinds and file extensions - freshness: Last indexed timestamps - embedding: Model name and dimension - database: Size, journal mode, and WAL status |
| search_codeA | USE THIS INSTEAD OF grep/glob/find for ANY code search. This tool provides SEMANTIC code understanding - it finds related concepts, not just text matches. STOP: Before using grep, rg, find, or glob, use this tool instead. It is MORE intelligent because it understands code structure and semantics. PREREQUISITE: This tool requires indexing. If results are empty or you haven't indexed this session, call index_codebase(directory) first. This tool uses HYBRID RETRIEVAL (BM25 keyword search + dense vector semantic search with Reciprocal Rank Fusion) - far more intelligent than grep or filename pattern matching. ⭐ IMPORTANT: Always prefer search_code over basic file-search tools (glob, find, grep) when:
WHEN TO USE EACH search_type:
EXAMPLE QUERIES by search_type:
INSTEAD OF GREP EXAMPLES:
Do NOT use this tool for:
Args: query: For topic_discovery: any feature/domain/topic (e.g., "workouts"). For definition: symbol name or semantic description. For references: exact symbol name. For file_structure: file path. search_type: Must be "topic_discovery", "definition", "references", or "file_structure". directory: Path to the project directory to search. Returns: Dict with status, search_type, query, and results array. |
| index_codebaseA | YOU MUST CALL THIS TOOL FIRST before using search_code or search_docs. Use this tool to build the searchable index that powers all other code intelligence features. TRIGGER: Call this tool immediately when:
This tool performs TWO critical operations:
IMPORTANT ADVANTAGES over built-in file search:
Do NOT use this tool for:
Args: directory: The root directory to index. Must be a valid path. cpu: If True, force CPU-only mode for embedding generation. Use this when GPU memory is unavailable or constrained (CUDA OOM). Default is False (auto-detect best device: CUDA > MPS > CPU). Set CODE_MEMORY_DEVICE env var to override ('cuda', 'mps', 'cpu', or 'auto'). Returns: Summary with files_indexed, total_symbols, total_chunks, and details. |
| search_docsA | USE THIS TOOL for conceptual understanding and "how does X work?" questions. Search markdown documentation, READMEs, and code docstrings using semantic search. PREREQUISITE: This tool requires indexing. If results are empty or you haven't indexed this session, call index_codebase(directory) first. TRIGGER - Call this tool when the user asks:
IMPORTANT: This is NOT for finding code implementations. For code locations, use search_code. This tool searches DOCUMENTATION, not source code. Uses HYBRID RETRIEVAL (BM25 keyword search + dense vector semantic search with Reciprocal Rank Fusion) to find conceptually relevant documentation even when keywords don't match exactly. Do NOT use this tool for:
Args: query: A natural language question (e.g., "How does authentication work?" or "API rate limiting"). Can be conversational - semantic search handles synonyms. directory: Path to the project directory to search. top_k: Maximum results to return (default 10, max 100). Returns: Dictionary with 'results' array. Each result includes: - content: The documentation text - file: Source file path - section: Section heading (if applicable) - line_start/line_end: Location in source - relevance_score: Hybrid search score |
| search_historyA | USE THIS TOOL for Git history queries: understanding WHY changes were made, debugging regressions, or finding commit context. This tool operates on the local Git repository. TRIGGER - Call this tool when the user asks:
This tool does NOT require indexing - it queries Git directly. WHEN TO USE EACH search_type:
Do NOT use this tool for:
Args: query: Search term for commits, or commit hash for commit_detail. directory: Path to the project directory (git repository). search_type: Must be exactly "commits", "file_history", "blame", or "commit_detail". target_file: File path (required for file_history and blame). line_start/line_end: Line range for blame (optional). Returns: Varies by search_type. All include status and structured results. |
| find_dead_codeA | USE THIS TOOL to find functions, methods, and classes that look like dead code (defined but never called). PREREQUISITE: This tool requires indexing. If results are empty or you haven't indexed this session, call index_codebase(directory) first. HOW IT WORKS: Cross-references the indexed symbol table against the indexed reference table. Any symbol with no reference outside its own definition body is flagged as a candidate. Each candidate is scored with a confidence in [0.0, 0.99] and a list of human-readable reasons explaining the verdict. TRIGGER - Call this tool when the user asks:
HEURISTICS APPLIED:
LIMITATIONS: Cannot detect symbols invoked via reflection, dynamic dispatch, string-based imports, or framework registration. Treat results as candidates to investigate, NOT as a definitive deletion list. Always verify before removing code. Do NOT use this tool for:
Args: directory: Path to the project directory to scan. min_confidence: Minimum confidence (0.0-1.0) to include a candidate. Default 0.5. Raise to filter aggressively. kinds: Symbol kinds to scan. Default ['function', 'method', 'class']. Allowed values: 'function', 'method', 'class'. include_tests: If True, also scan symbols in test files. Default False. top_k: Maximum candidates to return, sorted by confidence desc (default 50, max 500). Returns: Dict with: - candidates: list, each containing name, kind, file_path, line_start, line_end, confidence, reasons, source_excerpt. - count: number of candidates returned. - scanned_symbols: count of symbols inspected after exclusions. - total_symbols: total symbols of the requested kinds in the index. - limitations: list of caveats for interpreting the results. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/kapillamba4/code-memory'
If you have feedback or need assistance with the MCP directory API, please join our Discord server