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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

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 "未知错误"
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool 'remembers' content but doesn't explain what this means operationally: where content is stored, for how long, whether it's persistent, what permissions are needed, or what happens on success/failure. The description is too vague about the actual behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately concise with two sentences that directly address purpose and parameter semantics. The structure is clear with a purpose statement followed by parameter explanation. No wasted words, though it could be slightly more complete.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has an output schema (which handles return values) and only one parameter, the description covers the basics but leaves significant gaps. For a memory tool with no annotations, it should explain more about storage behavior, persistence, and error conditions. The description is minimally adequate but incomplete for confident tool selection.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage and only one parameter, the description adds significant value by explaining that 'content' can be '一句话、一段文字甚至更长的文本' (a sentence, a paragraph, or even longer text). This provides helpful semantic context about acceptable input formats that the schema alone doesn't convey. However, it doesn't mention length limits or content restrictions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool's purpose as '记住一些内容' (memorize some content), which is a clear verb+object combination. However, it doesn't differentiate from its sibling 'recall_memory_tool' beyond the basic memorization vs recall distinction. The purpose is understandable but lacks specificity about what kind of content or context is appropriate.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. There's no mention of the sibling tool 'recall_memory_tool' or any context about when memorization is appropriate versus other operations. The user must infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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