Auto-log episode entries on MCP memory_store (default true)

MCP store was missing the --episode behavior that the CLI had,
so episodes stopped being logged when sessions switched to using
MCP tools. Now defaults to true with opt-out via episode=false.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Cal Corum 2026-02-19 15:11:40 -06:00
parent aed98a3cc8
commit 09429eec3a

View File

@ -52,6 +52,10 @@ def create_tools() -> list:
"type": "number", "type": "number",
"description": "Importance score from 0.0 to 1.0 (default 0.5)", "description": "Importance score from 0.0 to 1.0 (default 0.5)",
}, },
"episode": {
"type": "boolean",
"description": "Also log an episode entry for this memory (default true)",
},
}, },
"required": ["type", "title", "content"], "required": ["type", "title", "content"],
}, },
@ -408,14 +412,32 @@ def handle_tool_call(
try: try:
if tool_name == "memory_store": if tool_name == "memory_store":
mem_type = arguments["type"]
title = arguments["title"]
tags = arguments.get("tags")
memory_id = client.store( memory_id = client.store(
type=arguments["type"], type=mem_type,
title=arguments["title"], title=title,
content=arguments["content"], content=arguments["content"],
tags=arguments.get("tags"), tags=tags,
importance=arguments.get("importance", 0.5), importance=arguments.get("importance", 0.5),
) )
return ok({"success": True, "memory_id": memory_id}) # Auto-log episode entry (default true, opt-out with episode=false)
episode_logged = False
if arguments.get("episode", True):
client.episode(
type=mem_type,
title=title,
tags=tags,
)
episode_logged = True
return ok(
{
"success": True,
"memory_id": memory_id,
"episode_logged": episode_logged,
}
)
elif tool_name == "memory_recall": elif tool_name == "memory_recall":
results = client.recall( results = client.recall(