MCP Tools Reference
Relevant source files
The following files were used as context for generating this wiki page:
The MCP Tools Reference provides a comprehensive overview of the Model Context Protocol (MCP) surface area exposed by the Memory Context Browser (MCB). MCB serves as a high-performance MCP server that facilitates semantic code search, persistent memory, and architecture validation for AI coding agents.
The system exposes 24 public tool names categorized into 9 operation families. These tools allow external clients, such as Claude Desktop or Claude Code, to interact with the underlying codebase analysis and memory persistence layers through a standardized protocol.
Sources: README.md:1-12, README.md:52-54, crates/mcb-server/tests/unit/mcp_server/mcp_contract_tests.rs:25-50
Tool Architecture and Registration
MCB utilizes a multi-layered architecture where tool handlers are registered and routed through the mcb-server crate. Tools are defined using custom macros (tool_action!, tool_schema!, tool_enum!) and registered via linkme distributed slices, which ensures zero runtime overhead for provider registration.
Tool Request Flow
When an MCP client calls a tool, the request follows a structured path from the protocol transport layer to the specific domain logic.
The diagram shows the sequence from initial client request through transport, routing, validation, and final dispatch to the domain logic.
Sources: crates/mcb-server/src/tools/mod.rs:10-18, AGENTS.md:310-325, README.md:76-80
Tool Families and Definitions
The 24 public tools are grouped into functional families. Each tool enforces a strict schema and requires specific execution provenance for data-plane operations.
Operation Families Table
| Family | Public Tools | Purpose |
|---|---|---|
| Search | search_code, search_memory | Semantic retrieval of code or stored observations. |
| Index | index_repo, index_status, clear_index | Management of vector embeddings and codebase indexing. |
| Validate | validate_code, analyze_code, list_rules | Enforcement of Clean Architecture rules via mcb-validate. |
| Memory | store_memory, get_memories, list_memories, memory_timeline, inject_context | Persistent cross-session observation storage. |
| Session | start_session, get_session, list_sessions, summarize_session | Lifecycle management for agent interaction sessions. |
| Agent | log_tool_call, log_delegation | Logging of internal agent behaviors and task handoffs. |
| VCS | list_repos, compare_branches, analyze_impact | Git-aware repository analysis and comparison. |
| Project/Entity | project, entity | High-level compound tools for project and entity context. |
Sources: README.md:52-66, crates/mcb-server/tests/unit/mcp_server/mcp_contract_tests.rs:25-50
Tool Schemas (Example: Search)
Tools use JSON schemas for input validation. The search_code and search_memory tools are derived from a base SearchArgs structure but expose specific fields to the MCP interface.
// crates/mcb-server/src/args/search.rs:89-111
tool_action! {
/// Arguments for the `search_code` tool.
pub struct SearchCodeArgs => SearchArgs {
#[schemars(description = "What you're looking for, in plain English")]
#[validate(length(min = 1))]
query: String,
#[schemars(description = "Maximum results (default: 10)", with = "u32")]
limit: Option<u32>,
#[schemars(description = "Filter by file extensions (e.g. [\"rs\", \"py\"])", with = "Vec<String>")]
extensions: Option<Vec<String>>,
#[schemars(description = "Minimum relevance score from 0.0 to 1.0", with = "f32")]
#[validate(range(min = 0.0, max = 1.0))]
min_score: Option<f32>
// ... hidden fields for provenance ...
}
}
Sources: crates/mcb-server/src/args/search.rs:20-80, crates/mcb-server/src/args/search.rs:89-111
Execution Context and Provenance
Critical "data-plane" tools (such as search_code and store_memory) reject requests that lack proper Execution Provenance. This context ensures that operations are tracked back to specific sessions, repositories, and operators.
Provenance Requirements
The ToolExecutionContext must contain the following fields for sensitive operations:
session_id: Unique identifier for the interaction.repo_id: The repository being operated upon.operator_id: The identity of the user or agent invoking the tool.delegated: Boolean indicating if the tool call is from a sub-agent.timestamp: Epoch time of the call.
Sources: crates/mcb-server/tests/unit/mcp_server/mcp_contract_tests.rs:77-90, crates/mcb-server/tests/unit/mcp_server/mcp_contract_tests.rs:118-140
Operation Mode Matrix
The server enforces an operation mode matrix to prevent invalid flows, such as blocking validate_code in a SERVER_HYBRID execution flow to maintain security and consistency.
This diagram illustrates the enforcement of the Operation Mode Matrix during a tool call.
Sources: crates/mcb-server/tests/unit/mcp_server/mcp_contract_tests.rs:163-178, crates/mcb-server/src/tools/mod.rs:17-21
Implementation Constraints
Developers adding or modifying tools must adhere to the Strictness Policy and Clean Architecture rules:
- Zero-Tolerance for Fallbacks: Utilities and tools must fail fast on invalid inputs (e.g., no
unwrap_or_default()for critical data). - Inward Dependency Flow: Tools in
mcb-servermust use services through DI ports defined inmcb-domain. - Schema Consistency: Every tool must provide a valid JSON object schema with a defined
type.
Sources: crates/mcb-domain/src/utils/UTILITIES_POLICY.md:46-65, AGENTS.md:290-305, crates/mcb-server/tests/unit/mcp_server/mcp_contract_tests.rs:105-115
Summary
The MCP Tools Reference defines the bridge between AI agents and the MCB analysis engine. By enforcing 24 strictly-typed tools across 9 families, MCB provides a stable, secure, and verifiable interface for codebase interaction. The integration of execution provenance and the operation mode matrix ensures that all agent actions are contextualized and permitted according to the current runtime configuration.