Skip to main content
Glama
little2512

Word Document Reader MCP Server

by little2512

get_cache_stats

Retrieve cache statistics to monitor performance and optimize document processing efficiency in the Word Document Reader MCP Server.

Instructions

获取缓存统计信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • server.js:542-549 (registration)
    Registration of the 'get_cache_stats' tool in the ListTools response, including name, description, and empty input schema.
    {
      name: "get_cache_stats",
      description: "获取缓存统计信息",
      inputSchema: {
        type: "object",
        properties: {}
      }
    },
  • Handler for the 'get_cache_stats' tool: retrieves stats from CacheManager and DocumentIndexer instances, formats a detailed stats text response including document cache size and index stats.
    case "get_cache_stats": {
      const documentStats = await cacheManager.getStats();
      const indexStats = documentIndexer.getStats();
    
      const statsText = `缓存统计信息:\n\n` +
        `文档缓存:\n` +
        `- 缓存文件数: ${documentStats.totalCached}\n` +
        `- 总缓存大小: ${(documentStats.totalSize / 1024 / 1024).toFixed(2)} MB\n\n` +
        `全文索引:\n` +
        `- 索引词汇数: ${indexStats.totalWords}\n` +
        `- 索引文档数: ${indexStats.totalDocuments}\n` +
        `- 最后更新: ${new Date(indexStats.lastUpdated).toLocaleString()}`;
    
      return {
        content: [
          {
            type: "text",
            text: statsText
          }
        ]
      };
    }
  • CacheManager.getStats(): Computes and returns document cache statistics including total number of cached items, total size in bytes, and metadata.
    async getStats() {
      await this.initialize();
      const metadata = await fs.readJson(this.metadataFile);
      const keys = Object.keys(metadata);
    
      return {
        totalCached: keys.length,
        totalSize: keys.reduce((sum, key) => sum + (metadata[key].size || 0), 0),
        files: metadata
      };
    }
  • DocumentIndexer.getStats(): Returns full-text index statistics: total unique words, total indexed documents, and last update timestamp.
    getStats() {
      return {
        totalWords: this.index.size,
        totalDocuments: this.documents.size,
        lastUpdated: this.lastUpdated
      };
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('get') but doesn't add any context about what the statistics include, whether it's a read-only operation, performance implications, or rate limits. This leaves significant gaps for a tool that likely provides system-level data.

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 a single, efficient sentence in Chinese ('获取缓存统计信息') that directly states the purpose without any wasted words. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly.

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?

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what the cache statistics include (e.g., hit rates, memory usage), the format of the return value, or any behavioral traits. For a tool that likely provides detailed system data, this leaves too much unspecified.

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 tool has 0 parameters with 100% schema description coverage, so the schema fully documents the absence of inputs. The description doesn't need to add parameter details, and it correctly implies no inputs are required, earning a high baseline score.

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 '获取缓存统计信息' (Get cache statistics) clearly states the verb 'get' and the resource 'cache statistics', providing a specific purpose. However, it doesn't differentiate from sibling tools like 'clear_cache' or 'get_stored_document', which prevents a perfect score.

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 'get_stored_document'. There's no mention of context, prerequisites, or exclusions, leaving the agent with minimal usage direction.

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