Tools Reference
MemLayer exposes four MCP tools. Claude calls these automatically based on conversation context.
memlayer_retain
Section titled “memlayer_retain”Store information the user wants remembered. Use when the user says “remember”, shares preferences, or provides facts about themselves.
| Parameter | Type | Required | Description |
|---|---|---|---|
content | string | Yes | The fact to remember. Write in third person: “User prefers X” not “I prefer X” |
source | string | No | Origin identifier: conversation, user_stated, or inferred |
Example call:
{ "content": "User's favorite programming language is Haskell", "source": "user_stated"}When Claude uses it: User says “Remember that my favorite language is Haskell.” Claude extracts the fact, rephrases it in third person, and calls retain.
Maps to: POST /api/v1/retain
memlayer_recall
Section titled “memlayer_recall”Search stored memories. Claude calls this before answering questions about user preferences, history, or previously shared information.
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Natural language search. Be specific: “programming language preference” not just “language” |
limit | integer | No | Max results (default: 5). Use 10+ for broad searches |
Example call:
{ "query": "favorite programming language", "limit": 5}When Claude uses it: User asks “What’s my favorite language?” Claude searches for semantically similar memories and uses the results to answer.
Maps to: GET /api/v1/recall
memlayer_reflect
Section titled “memlayer_reflect”Consolidate related memories into higher-level summaries. Use sparingly — only when the user asks to organize memories or after many retain calls.
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | No | Only consolidate memories about this topic |
Example call:
{ "query": "programming"}When Claude uses it: User says “Organize my memories about programming.” Claude scopes the reflection to programming-related facts.
Maps to: POST /api/v1/reflect
memlayer_forget
Section titled “memlayer_forget”Permanently delete an entity and all its data (memories, relationships, embeddings). Use when explicitly asked to forget something.
| Parameter | Type | Required | Description |
|---|---|---|---|
entity_id | string | Yes | The entity_id to forget (get this from recall results) |
Example call:
{ "entity_id": "user-haskell-preference"}When Claude uses it: User says “Forget my programming preferences.” Claude first calls recall to find matching memories, reads the entity_id from the results, then calls forget with that ID.
Maps to: POST /api/v1/forget
Tool discovery
Section titled “Tool discovery”When Claude connects to MemLayer via MCP, it receives the tool definitions automatically through the tools/list JSON-RPC method. The descriptions guide Claude on when and how to use each tool.
You can inspect the raw tool definitions in the source at src/MemLayer/MCP/Tools.hs.