Skip to main content
Glama

memorize_memory_tool

Store project information and content as memories in Claude Desktop for later retrieval using keyword-based search.

Instructions

记住一些内容

Args: content: 要记住的内容。可以是一句话、一段文字甚至更长的文本。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYes

Implementation Reference

  • Handler function for the 'memorize_memory_tool'. Registered via @mcp.tool() decorator. Schedules background memorization task and returns confirmation.
    @mcp.tool() async def memorize_memory_tool(content: str) -> str: """记住一些内容 Args: content: 要记住的内容。可以是一句话、一段文字甚至更长的文本。 """ asyncio.create_task(_memorize_with_logging(content, _registry)) return "内容正在后台记忆中"
  • Helper function that performs the actual memorization call with logging and error handling, invoked in background.
    async def _memorize_with_logging(content: str, registry: MemoryRegistry): """带日志记录的后台记忆任务""" try: result = await memorize_memory(content, registry) print(f"[记忆完成] {result}", file=sys.stderr) except Exception as e: print(f"[记忆失败] {e}", file=sys.stderr)
  • Core helper function implementing the memorization logic using small_agent with sub-tools for listing, reading, creating, and updating memories. Handles intelligent decision-making for saving content.
    async def memorize_memory(content: str, registry: MemoryRegistry) -> str: """使用 small_agent 实现的保存流程""" list_tool = ListMemoriesTool(registry) read_tool = ReadMemoryTool(registry) create_tool = CreateMemoryTool(registry) update_tool = UpdateMemoryTool(registry) final_tools: list[ToolUnionParam] = [ { "name": "done", "description": "完成所有保存操作", "input_schema": { "type": "object", "properties": { "summary": { "type": "string", "description": "操作摘要(已创建/更新了哪些记忆)", } }, "required": ["summary"], }, } ] initial_prompt = f"""把以下内容保存到记忆库中: {content} --------- 请按以下指导处理: 1. 使用 list_memories 搜索相似的现有记忆 2. 使用 read_memory 读取相关记忆 3. 决定并执行操作(可以多次): - 调用 update_memory 把新内容合并到现有记忆中 - 调用 create_memory 创建新的记忆 4. 完成所有操作后,调用 done **重要约束**: - 每个记忆 ≤ 1000 字 - Keywords:小写字母,准确反映主题 **更新时**: - 融合新旧内容,避免重复 - 保持内容完整性和连贯性 **创建时**: - 内容应独立、完整 - Keywords 应准确、简洁 **工具会返回成功或失败消息**,请根据反馈调整""" result = await small_agent( initial_prompt=initial_prompt, tools=[list_tool, read_tool, create_tool, update_tool], final=final_tools, maxIter=10, ) if result is None: return "保存超时,未能完成操作" tool_name, tool_input = result if tool_name == "done": summary = tool_input.get("summary", "") return f"✓ 操作完成\n\n{summary}" return "未知错误"
Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/JerryZhongJ/memory-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server