Tools Reference
Complete reference for all MCP tools exposed by the memories.sh server.
The hosted memories.sh MCP endpoint exposes 9 tenant-routed core tools. The local CLI MCP server (memories serve) extends that surface with 5 lifecycle tools, 6 reminder tools, and 4 streaming tools.
SaaS apps that already call SDK endpoints (/api/sdk/v1/*) do not need these MCP tools unless they serve MCP-native clients.
Scope model for MCP arguments:
tenant_id= AI SDK Project (security/database boundary)user_id= end-user scope insidetenant_idproject_id= optional repo context filter (not auth boundary)
Availability notes:
- Hosted MCP (
https://memories.sh/api/mcp) supports the tenant-routed core toolset documented here. - Local CLI MCP (
memories serve) includes additional lifecycle, reminder, and streaming tools.
get_context
The primary tool for AI agents. Returns all active rules (with path and category metadata) plus memories relevant to an optional search query.
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | No | Search query to find relevant memories |
project_id | string | No | Project identifier (e.g., github.com/user/repo) as an optional repo context filter |
user_id | string | No | End-user scope identifier inside tenant_id |
tenant_id | string | No | AI SDK Project identifier for security/database routing |
limit | number | No | Max memories to return (default: 5) |
retrieval_strategy | string | No | Hosted MCP graph strategy: baseline or hybrid_graph |
graph_depth | number | No | Hosted MCP graph traversal depth (0, 1, 2) |
graph_limit | number | No | Hosted MCP max graph-expanded memories |
mode | string | No | Local CLI only: all, working, long_term, rules_only |
session_id | string | No | Local CLI only: session identifier for lifecycle-aware retrieval |
budget_tokens | number | No | Local CLI only: context token budget hint |
turn_count | number | No | Local CLI only: current turn count |
turn_budget | number | No | Local CLI only: turn-count budget |
last_activity_at | string | No | Local CLI only: ISO timestamp for inactivity-trigger checks |
inactivity_threshold_minutes | number | No | Local CLI only: inactivity threshold for time-trigger checks |
task_completed | boolean | No | Local CLI only: semantic completion hint for checkpointing |
include_session_summary | boolean | No | Local CLI only: reserved summary hydration flag |
{
"name": "get_context",
"arguments": {
"query": "authentication flow",
"project_id": "github.com/user/repo",
"limit": 5
}
}Returns all rules first (including path scope and category when set), followed by relevant search results. Uses FTS5 with BM25 ranking for the search query, falling back to LIKE matching for databases without FTS support. When hybrid graph retrieval is enabled, semantically similar memories may be added via graph similar_to edges, and conflict/refinement links may be traversed via contradicts / supersedes edges when LLM extraction is enabled.
When local memories serve callers provide session_id and compaction hints (budget_tokens, turn_budget/turn_count, inactivity fields, or task_completed), get_context may emit a compaction section and perform write-ahead checkpointing before destructive compaction.
If returned memories include contradiction links, the response also includes a conflicts[] array with pair IDs, confidence, explanation text, and a suggestion for clarification.
Example structuredContent conflict payload fragment:
{
"data": {
"memories": [
{ "id": "mem_a", "content": "I prefer tea in the afternoon." },
{ "id": "mem_b", "content": "I avoid tea after lunch." }
],
"conflicts": [
{
"memoryAId": "mem_a",
"memoryBId": "mem_b",
"edgeType": "contradicts",
"confidence": 0.88,
"explanation": "These memories are linked by a contradiction edge from relationship extraction.",
"suggestion": "These memories may conflict. Consider asking the user to clarify which preference is current."
}
],
"trace": {
"strategy": "hybrid_graph",
"conflictCount": 1
}
}
}start_session (local CLI only)
Start a new session for checkpointing and snapshot workflows.
| Parameter | Type | Required | Description |
|---|---|---|---|
title | string | No | Optional session title |
client | string | No | Client label (for example codex, cursor) |
user_id | string | No | Optional user identifier |
metadata | object | No | Optional session metadata object |
global | boolean | No | Start as global session |
project_id | string | No | Explicit project identifier |
{
"name": "start_session",
"arguments": {
"title": "Refactor auth middleware",
"client": "codex",
"project_id": "github.com/webrenew/memories"
}
}checkpoint_session (local CLI only)
Append an event/checkpoint to an active session.
| Parameter | Type | Required | Description |
|---|---|---|---|
session_id | string | Yes | Session ID |
content | string | Yes | Event content |
role | string | No | user, assistant, or tool (default: assistant) |
kind | string | No | message, checkpoint, summary, or event (default: checkpoint) |
token_count | number | No | Optional token count for this event |
turn_index | number | No | Optional turn index |
is_meaningful | boolean | No | Whether event is meaningful (default: true) |
{
"name": "checkpoint_session",
"arguments": {
"session_id": "sess_123",
"content": "User approved migration strategy",
"kind": "summary",
"token_count": 320
}
}end_session (local CLI only)
Close a session when task context is complete.
| Parameter | Type | Required | Description |
|---|---|---|---|
session_id | string | Yes | Session ID |
status | string | No | Final status: closed or compacted (default: closed) |
{
"name": "end_session",
"arguments": {
"session_id": "sess_123",
"status": "compacted"
}
}snapshot_session (local CLI only)
Create a raw markdown snapshot from explicit transcript text or recent session events.
| Parameter | Type | Required | Description |
|---|---|---|---|
session_id | string | Yes | Session ID |
source_trigger | string | No | new_session, reset, manual, or auto_compaction (default: manual) |
slug | string | No | Optional snapshot slug |
transcript_md | string | No | Explicit transcript markdown |
message_count | number | No | Event count when transcript is generated (default: 15) |
meaningful_only | boolean | No | Include only meaningful events when generating transcript (default: true) |
{
"name": "snapshot_session",
"arguments": {
"session_id": "sess_123",
"source_trigger": "reset",
"message_count": 15
}
}consolidate_memories (local CLI only)
Run consolidation to merge duplicates, supersede stale truths, and write consolidation audit rows.
| Parameter | Type | Required | Description |
|---|---|---|---|
types | string[] | No | Memory types to include (rule, decision, fact, note, skill) |
include_global | boolean | No | Include global memories (default: true) |
global_only | boolean | No | Restrict to global memories only |
project_id | string | No | Explicit project identifier |
dry_run | boolean | No | Preview only; do not mutate rows |
model | string | No | Optional model identifier for audit metadata |
{
"name": "consolidate_memories",
"arguments": {
"types": ["rule", "decision", "fact"],
"project_id": "github.com/webrenew/memories",
"dry_run": true
}
}add_memory
Store a new memory with optional metadata, path scoping, and categorization.
| Parameter | Type | Required | Description |
|---|---|---|---|
content | string | Yes | Memory content |
type | enum | No | rule, decision, fact, note, skill (default: note) |
tags | string[] | No | Array of tags |
project_id | string | No | Optional project/repo context filter (omit for global) |
user_id | string | No | End-user scope identifier inside tenant_id |
tenant_id | string | No | AI SDK Project identifier for security/database routing |
paths | string[] | No | Glob patterns for path-scoped rules |
category | string | No | Grouping key (becomes rule filename or skill directory) |
metadata | object | No | Extended attributes (JSON object, primarily for skills) |
{
"name": "add_memory",
"arguments": {
"content": "Use RESTful naming conventions for all endpoints",
"type": "rule",
"paths": ["src/api/**", "src/routes/**"],
"category": "api"
}
}Adding a skill:
{
"name": "add_memory",
"arguments": {
"content": "## Deploy\n\n1. Run tests\n2. Build\n3. Deploy to production",
"type": "skill",
"category": "deploy",
"metadata": {
"name": "deploy",
"description": "Deploy the application to production"
}
}
}search_memories
Full-text search across memories with BM25 ranking. Uses FTS5 when available, falling back to LIKE matching.
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Search query |
project_id | string | No | Optional project/repo context filter |
user_id | string | No | End-user scope identifier inside tenant_id |
tenant_id | string | No | AI SDK Project identifier for security/database routing |
type | enum | No | Filter by memory type: rule, decision, fact, note, skill |
limit | number | No | Max results (default: 10) |
{
"name": "search_memories",
"arguments": {
"query": "database schema",
"project_id": "github.com/user/repo",
"type": "decision"
}
}get_rules
Get all active rules, split by global and project scope.
| Parameter | Type | Required | Description |
|---|---|---|---|
project_id | string | No | Optional project/repo context filter |
user_id | string | No | End-user scope identifier inside tenant_id |
tenant_id | string | No | AI SDK Project identifier for security/database routing |
{
"name": "get_rules",
"arguments": {
"project_id": "github.com/user/repo"
}
}list_memories
List recent memories with optional filters.
| Parameter | Type | Required | Description |
|---|---|---|---|
type | enum | No | Filter by type: rule, decision, fact, note, skill |
tags | string | No | Filter by tag (substring match — "test" also matches "testing") |
project_id | string | No | Optional project/repo context filter |
user_id | string | No | End-user scope identifier inside tenant_id |
tenant_id | string | No | AI SDK Project identifier for security/database routing |
limit | number | No | Max results (default: 20) |
edit_memory
Update an existing memory's content, type, tags, path scope, or category.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Memory ID |
content | string | No | New content |
type | enum | No | New type (rule, decision, fact, note, skill) |
tags | string[] | No | New tags |
paths | string[] | No | New glob patterns for path scoping |
category | string | No | New grouping key |
metadata | object | No | New extended attributes |
user_id | string | No | End-user scope identifier inside tenant_id |
tenant_id | string | No | AI SDK Project identifier for security/database routing |
{
"name": "edit_memory",
"arguments": {
"id": "abc123def456",
"paths": ["src/api/**"],
"category": "api"
}
}forget_memory
Soft-delete a memory by ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Memory ID to forget |
user_id | string | No | End-user scope identifier inside tenant_id |
tenant_id | string | No | AI SDK Project identifier for security/database routing |
bulk_forget_memories
Bulk soft-delete memories matching filters. Use dry_run: true to preview what would be deleted before committing.
| Parameter | Type | Required | Description |
|---|---|---|---|
types | string[] | No | Filter by memory types (rule, decision, fact, note, skill) |
tags | string[] | No | Filter by tags (substring match — "test" also matches "testing") |
older_than_days | integer | No | Delete memories older than N days (must be >= 1) |
pattern | string | No | Content pattern match (* = any chars, ? = single char; matches anywhere in content) |
project_id | string | No | Filter by project identifier |
user_id | string | No | End-user scope identifier inside tenant_id |
tenant_id | string | No | AI SDK Project identifier for security/database routing |
all | boolean | No | Delete all memories (cannot combine with other filters) |
dry_run | boolean | No | Preview matching memories without deleting (default: false) |
Provide at least one filter (types, tags, older_than_days, or pattern), or use all: true. The all flag cannot be combined with other filters.
{
"name": "bulk_forget_memories",
"arguments": {
"types": ["note", "fact"],
"older_than_days": 90,
"dry_run": true
}
}With dry_run: true, returns a preview with count and memories[] (each with id, type, contentPreview). With dry_run: false, returns count and ids[] of deleted memories. Deletes are batched in groups of 500.
vacuum_memories
Permanently purge all soft-deleted memories to reclaim storage space. This hard-deletes every row where deleted_at IS NOT NULL.
| Parameter | Type | Required | Description |
|---|---|---|---|
user_id | string | No | End-user scope identifier inside tenant_id |
tenant_id | string | No | AI SDK Project identifier for security/database routing |
{
"name": "vacuum_memories",
"arguments": {}
}Returns purged (count of permanently removed records) and a message string.
Local CLI Reminder Tools
The reminder tools below are available in the local CLI MCP server (memories serve). They are not part of hosted tenant-routed MCP today.
add_reminder
Create a cron-based reminder.
| Parameter | Type | Required | Description |
|---|---|---|---|
cron_expression | string | Yes | 5-field cron expression (minute hour day-of-month month day-of-week) |
message | string | Yes | Reminder message |
global | boolean | No | Store as global reminder |
project_id | string | No | Explicit project identifier |
list_reminders
List reminders in current scope.
| Parameter | Type | Required | Description |
|---|---|---|---|
include_disabled | boolean | No | Include disabled reminders |
project_id | string | No | Explicit project identifier |
run_due_reminders
Evaluate and emit due reminders.
| Parameter | Type | Required | Description |
|---|---|---|---|
dry_run | boolean | No | Preview due reminders without advancing schedule |
project_id | string | No | Explicit project identifier |
enable_reminder
Enable a reminder and recompute next_trigger_at.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Reminder ID |
disable_reminder
Disable a reminder without deleting it.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Reminder ID |
delete_reminder
Delete a reminder by ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Reminder ID |
Local CLI Streaming Tools
Streaming tools are available in local CLI MCP (memories serve) only.
start_memory_stream
Start a stream collector for chunked content.
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | No | Memory type (rule, decision, fact, note, skill) |
tags | string[] | No | Tags for the resulting memory |
global | boolean | No | Store as global memory |
project_id | string | No | Explicit project identifier |
append_memory_chunk
Append a chunk to an active stream.
| Parameter | Type | Required | Description |
|---|---|---|---|
stream_id | string | Yes | Stream ID from start_memory_stream |
chunk | string | Yes | Chunk content |
finalize_memory_stream
Finalize stream and create the memory.
| Parameter | Type | Required | Description |
|---|---|---|---|
stream_id | string | Yes | Stream ID from start_memory_stream |
cancel_memory_stream
Cancel stream and discard buffered chunks.
| Parameter | Type | Required | Description |
|---|---|---|---|
stream_id | string | Yes | Stream ID to cancel |