Skip to main content
Glama
little2512
by little2512

clear_memory

Clear cached data from the Word Document Reader MCP Server to free up memory and maintain optimal performance when processing documents.

Instructions

清除指定的内存内容

Input Schema

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

Implementation Reference

  • Handler implementation for the 'clear_memory' tool. Clears specific memoryKey from uiComponentMemory and documentMemory Maps, or clears all if no key provided. Returns success message or throws error if key not found.
    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} 个文档)` } ] }; } }
  • Tool registration for 'clear_memory' including name, description, and input schema definition.
    { name: "clear_memory", description: "清除指定的内存内容", inputSchema: { type: "object", properties: { memoryKey: { type: "string", description: "要清除的内存键名,如果不提供则清除所有" } } } }
  • Handler implementation for the 'clear_memory' tool in advanced server. Uses NodeCache's del() for specific key or flushAll() for all entries. Returns success or error.
    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)
    Tool registration for 'clear_memory' including name, description, and input schema in the advanced server.
    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