MCP Tools Reference
Relevant source files
The following files were used as context for generating this wiki page:
The Memory Context Browser (MCB) exposes a high-performance interface through the Model Context Protocol (MCP). This interface provides AI coding agents with capabilities for semantic code search, persistent memory management, and architectural validation. The system currently registers 24 public tool names, organized into specialized handler families to support complex agentic workflows and repository analysis.
Sources: README.md:6-15, AGENTS.md:143-146, crates/mcb-server/tests/unit/mcp_server/mcp_contract_tests.rs:24-49
Tool Architecture and Registry
The MCB server utilizes a registry-backed architecture for tool definition and dispatch. Tools are registered using linkme distributed slices, which create a static array of ToolDescriptor references at compile-time. This approach ensures a single source of truth for both tool listing (discovery) and execution (dispatch).
Tool Registration Flow
The following diagram illustrates how a tool request is resolved and dispatched through the registry.
The registration process uses the register_tool! macro to link unique tool names, descriptions, JSON schemas, and handler functions into the TOOL_DESCRIPTORS slice.
Sources: crates/mcb-server/src/tools/registry.rs:40-57, crates/mcb-server/src/tools/registry.rs:335-350
Core Components
| Component | Description |
|---|---|
ToolDescriptor | A struct containing the tool's name, description, schema factory, and dispatch function pointer. |
ToolHandlers | A collection of handler families (search, index, memory, etc.) that execute the business logic. |
ToolExecutionContext | Contextual metadata (session IDs, repo paths, agent info) used for provenance gating. |
TOOL_DESCRIPTORS | A distributed slice containing all registered tool definitions. |
Sources: crates/mcb-server/src/tools/registry.rs:47-57, crates/mcb-server/tests/unit/mcp_server/mcp_contract_tests.rs:64-83
Tool Categories and Capabilities
The MCB toolset is categorized into 9 operation families. These tools facilitate a full lifecycle of agent interaction, from initial code indexing to long-term memory retrieval.
Search and Indexing
The search tools utilize vector embeddings to perform semantic queries over both codebases and stored memories.
| Tool Name | Purpose | Key Arguments |
|---|---|---|
search_code | Semantic search over indexed project code. | query, limit, extensions, min_score |
search_memory | Semantic search over stored observations. | query, limit, tags, min_score |
index_repo | Trigger repository indexing for search. | (Auto-detects repository root) |
index_status | Query current progress of indexing tasks. | N/A |
Sources: crates/mcb-server/src/args/search.rs:100-117, crates/mcb-server/src/args/search.rs:133-146, crates/mcb-server/src/tools/registry.rs:106-125
Memory and Session Management
Memory tools allow agents to persist knowledge across sessions. The inject_context tool is specifically designed to enrich the agent's current prompt with the most relevant historical observations within a defined token budget.
Execution Constraints and Safety
MCB implements strict "Provenance Gating" for data plane tools. Tools like index_repo, search_code, and store_memory will reject requests that lack essential execution context.
Provenance Requirements
Requests must include valid metadata to pass the execution gate:
- Session ID: Tracking the current interaction.
- Repo ID: Identifying the target codebase.
- Operator ID: Identifying the user or system initiating the call.
- Timestamp: Recording the time of execution.
- Parent Session ID: Required for delegated agents to maintain the chain of custody.
Sources: crates/mcb-server/tests/unit/mcp_server/mcp_contract_tests.rs:125-145, crates/mcb-server/tests/unit/mcp_server/mcp_contract_tests.rs:155-165
Operation Mode Matrix
The system enforces a matrix that blocks certain tools depending on the execution_flow. For example, architectural validation (validate_code) is blocked in SERVER_HYBRID flows to prevent unauthorized resource consumption or security violations.
Sources: crates/mcb-server/tests/unit/mcp_server/mcp_contract_tests.rs:175-184
Summary of Registered Tools
The following table summarizes the primary public tools as defined in the server's registration logic.
| Family | Public Tool Names |
|---|---|
| Search | search_code, search_memory |
| Index | index_repo, index_status, clear_index |
| Memory | store_memory, get_memories, list_memories, memory_timeline, inject_context |
| Session | start_session, get_session, list_sessions, summarize_session |
| Validate | validate_code, analyze_code, list_rules |
| VCS | list_repos, compare_branches, analyze_impact |
| Agent | log_tool_call, log_delegation |
| Compound | project, entity |
Sources: crates/mcb-server/src/tools/registry.rs:90-310, README.md:65-75
MCB's tool system provides a robust, type-safe, and validated interface for AI agents to interact with complex software environments while maintaining strict architectural boundaries and provenance tracking.