Skip to main content
Glama
little2512
by little2512

clear_memory

Remove cached data from the Word document reader to free up system resources and manage memory usage efficiently.

Instructions

清除指定的内存内容

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
memoryKeyNo要清除的内存键名,如果不提供则清除所有

Implementation Reference

  • The handler function for 'clear_memory' tool in the main server. It removes a specific memoryKey from documentCache or flushes all if not specified, returning appropriate success/error messages.
    case "clear_memory": { const { memoryKey } = args; if (memoryKey) { const removed = documentCache.del(memoryKey); if (removed > 0) { return { content: [ { type: "text", text: `已清除内存键 "${memoryKey}" 的内容` } ] }; } else { throw new Error(`未找到内存键 "${memoryKey}" 的内容`); } } else { // 清除所有内存 const count = documentCache.keys().length; documentCache.flushAll(); return { content: [ { type: "text", text: `已清除所有内存内容 (共 ${count} 个文档)` } ] }; } }
  • server.js:594-605 (registration)
    Registration of the 'clear_memory' tool including name, description, and input schema in the server's tools list.
    name: "clear_memory", description: "清除指定的内存内容", inputSchema: { type: "object", properties: { memoryKey: { type: "string", description: "要清除的内存键名,如果不提供则清除所有" } } } }
  • The handler function for 'clear_memory' tool in the basic server. It deletes from uiComponentMemory and/or documentMemory.
    case "clear_memory": { const { memoryKey } = args; if (memoryKey) { const removedFromUI = uiComponentMemory.delete(memoryKey); const removedFromDoc = documentMemory.delete(memoryKey); if (removedFromUI || removedFromDoc) { return { content: [ { type: "text", text: `已清除内存键 "${memoryKey}" 的内容` } ] }; } else { throw new Error(`未找到内存键 "${memoryKey}" 的内容`); } } else { // 清除所有内存 const count = uiComponentMemory.size + documentMemory.size; uiComponentMemory.clear(); documentMemory.clear(); return { content: [ { type: "text", text: `已清除所有内存内容 (共 ${count} 个文档)` } ] }; } }
  • Registration of the 'clear_memory' tool including name, description, and input schema in the basic server's tools list.
    name: "clear_memory", description: "清除指定的内存内容", inputSchema: { type: "object", properties: { memoryKey: { type: "string", description: "要清除的内存键名,如果不提供则清除所有" } } } }

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/little2512/word-doc-mcp'

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