Skip to main content
Glama
little2512

Word Document Reader MCP Server

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: "要清除的内存键名,如果不提供则清除所有"
          }
        }
      }
    }
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. '清除' (clear) implies a destructive operation, but the description doesn't specify whether this is reversible, what permissions are required, whether it affects system performance, or what happens when memoryKey is omitted. The description mentions the optional parameter behavior but lacks critical behavioral context.

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

Conciseness5/5

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

The description is extremely concise - a single Chinese phrase that directly states the tool's function. There's zero wasted language, and it's front-loaded with the core action. This is appropriate conciseness for a simple tool.

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

Completeness2/5

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

For a destructive tool with no annotations and no output schema, the description is insufficient. It doesn't explain what 'memory' means in this context, what gets cleared, whether the operation is safe/reversible, what happens when all memory is cleared, or what the tool returns. Given the complexity of a memory-clearing operation, more context is needed.

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?

The description implies parameter semantics by mentioning '指定的' (specified), which aligns with the optional memoryKey parameter. With 100% schema description coverage and only one parameter, the description adds minimal but appropriate context about the parameter's purpose without duplicating schema information.

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 '清除指定的内存内容' (Clear specified memory content) states the verb (clear) and resource (memory content), but it's vague about what 'memory content' means in this context. It doesn't distinguish this tool from sibling tools like 'clear_cache' or explain what type of memory is being cleared.

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 like 'clear_cache' or other sibling tools. There's no mention of prerequisites, typical use cases, or when this tool would be preferred over other memory/cache management tools.

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

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