Skip to main content
Glama
little2512

Word Document Reader MCP Server

by little2512

clear_cache

Clear cached data from the Word Document Reader MCP Server to free up system resources and ensure document processing uses current information. Specify cache type: all, document, or index.

Instructions

清空所有缓存

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeNo清除类型:all, document, indexall

Implementation Reference

  • The handler logic for executing the 'clear_cache' tool. It processes the input 'type' parameter and clears the appropriate caches: document cache via CacheManager.clear(), index via DocumentIndexer.clear(), or all including NodeCache.flushAll().
    case "clear_cache": {
      const { type = "all" } = args;
    
      switch (type) {
        case "document":
          await cacheManager.clear();
          var clearedMessage = "已清空文档缓存";
          break;
        case "index":
          documentIndexer.clear();
          var clearedMessage = "已清空全文索引";
          break;
        case "all":
        default:
          await cacheManager.clear();
          documentIndexer.clear();
          documentCache.flushAll();
          var clearedMessage = "已清空所有缓存(文档缓存、全文索引、内存缓存)";
          break;
      }
    
      return {
        content: [
          {
            type: "text",
            text: clearedMessage
          }
        ]
      };
    }
  • server.js:550-564 (registration)
    Registration of the 'clear_cache' tool in the ListToolsRequestHandler response, including name, description, and input schema.
    {
      name: "clear_cache",
      description: "清空所有缓存",
      inputSchema: {
        type: "object",
        properties: {
          type: {
            type: "string",
            description: "清除类型:all, document, index",
            enum: ["all", "document", "index"],
            default: "all"
          }
        }
      }
    },
  • Input schema definition for the 'clear_cache' tool, specifying the optional 'type' parameter.
    inputSchema: {
      type: "object",
      properties: {
        type: {
          type: "string",
          description: "清除类型:all, document, index",
          enum: ["all", "document", "index"],
          default: "all"
        }
      }
  • CacheManager.clear() method used by the clear_cache handler to clear document caches.
    async clear() {
      await this.initialize();
      const files = await fs.readdir(this.cacheDir);
      for (const file of files) {
        if (file !== 'metadata.json') {
          await fs.remove(path.join(this.cacheDir, file));
        }
      }
      await fs.writeJson(this.metadataFile, {});
    }
  • DocumentIndexer.clear() method used by the clear_cache handler to clear the full-text index.
    clear() {
      this.index.clear();
      this.documents.clear();
      this.lastUpdated = Date.now();
    }
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. '清空所有缓存' implies a destructive operation that removes cached data, but it doesn't specify what types of data are affected, whether this requires special permissions, if the operation is reversible, what side effects might occur, or what happens after execution. For a potentially destructive tool, this is insufficient 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 - just four Chinese characters that directly convey the core function. There's zero wasted language or unnecessary elaboration. It's front-loaded with the essential information in the most compact form possible.

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 cache-clearing operation with no annotations and no output schema, the description is incomplete. It doesn't address important contextual questions: What does 'cache' refer to in this system? What are the consequences of clearing it? Are there different cache types? What confirmation or result should be expected? The single sentence leaves too many practical questions unanswered.

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

Parameters3/5

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

The description mentions 'all cache' which implies comprehensive clearing, but the input schema shows a 'type' parameter with three options (all, document, index). The description doesn't explain these options or their differences. With 100% schema description coverage, the baseline is 3, but the description adds minimal value beyond what's already in the schema.

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

Purpose4/5

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

The description '清空所有缓存' (Clear all cache) clearly states the action (clear) and target (cache), making the purpose immediately understandable. It doesn't specifically distinguish from sibling tools like 'clear_memory' or 'get_cache_stats', but the verb+resource combination is unambiguous for what this tool does.

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 when this operation is appropriate, what prerequisites might exist, or how it differs from sibling tools like 'clear_memory' or 'get_cache_stats'. The user must infer usage from the 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/little2512/word-doc-mcp'

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