Lesson 5: claude-mem MCP Tools and Querying in Practice
5.1 What are MCP Tools?
MCP (Model Context Protocol) tools are capabilities that the LLM can call autonomously. claude-mem exposes three core MCP tools for retrieving information from its knowledge base on demand.
5.2 The Three Core Tools
| Tool Name | Purpose | Typical Query Example |
|---|---|---|
search |
Hybrid full-text and vector search with filters for type, date, and project. | search "Redis lock failure" |
timeline |
Retrieves timeline context surrounding a specific record. | "Check the discussion before and after this bug fix." |
get_observations |
Retrieves full details for one or more records by ID. | (Usually guided by search results.) |
5.3 Advanced Query Syntax
The search tool supports a rich set of filtering syntax to help the LLM pinpoint targets:
- Boolean Logic:
redis AND lock(contains both),postgres OR mysql(contains either). - Exclude Keywords:
auth NOT mock. - Phrase Matching:
"connection refused". - Metadata Filtering:
type:bugfix project:openclaw date:>2026-04-01.
5.4 Progressive Disclosure Design
claude-mem utilizes a three-tier retrieval design to save on Token costs:
- Tier 1 (
search): Returns only IDs and very compact summaries (approx. 50-100 Tokens per entry). - Tier 2 (
timeline): If the LLM needs more context, it can query adjacent events. - Tier 3 (
get_observations): Loads the full record content only after confirming relevance.
This design makes claude-mem approximately 10 times more Token-efficient than traditional full-scale RAG (Retrieval-Augmented Generation).