Skip to main content
Glama
little2512

Word Document Reader MCP Server

by little2512

list_stored_documents

Retrieve all stored Word documents with optional filtering by document type to manage your document library efficiently.

Instructions

列出所有已存储的文档

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
documentTypeNo筛选特定类型的文档

Implementation Reference

  • Handler implementation for the 'list_stored_documents' tool in the basic server. It collects documents from uiComponentMemory and documentMemory Maps, filters by documentType if specified, formats a list, and returns a text response.
    case "list_stored_documents": {
      const { documentType } = args;
      let docs = [];
    
      if (!documentType || documentType === "ui-component") {
        for (const [key, doc] of uiComponentMemory.entries()) {
          docs.push({ ...doc, memoryKey: key, storage: "ui-component" });
        }
      }
    
      if (!documentType || documentType !== "ui-component") {
        for (const [key, doc] of documentMemory.entries()) {
          if (!documentType || doc.documentType === documentType) {
            docs.push({ ...doc, memoryKey: key, storage: "document" });
          }
        }
      }
    
      const docList = docs.map(doc =>
        `- 内存键: ${doc.memoryKey}\n  文件路径: ${doc.filePath}\n  文档类型: ${doc.documentType}\n  存储时间: ${doc.timestamp}\n  内容长度: ${doc.content.length} 字符`
      ).join('\n\n');
    
      return {
        content: [
          {
            type: "text",
            text: `已存储的文档 (${docs.length} 个):\n\n${docList || "暂无存储的文档"}`
          }
        ]
      };
    }
  • Handler implementation for the 'list_stored_documents' tool in the enhanced server. It iterates over documentCache (NodeCache) keys, retrieves documents, filters by documentType, includes additional metadata like tables and images count, and returns a formatted text list.
    case "list_stored_documents": {
      const { documentType } = args;
      const docs = [];
    
      const keys = documentCache.keys();
      for (const key of keys) {
        const doc = documentCache.get(key);
        if (!documentType || doc.documentType === documentType) {
          docs.push(doc);
        }
      }
    
      const docList = docs.map(doc =>
        `- 内存键: ${doc.memoryKey}\n  文件路径: ${doc.filePath}\n  文档类型: ${doc.documentType}\n  存储时间: ${doc.timestamp}\n  内容长度: ${doc.text?.length || 0} 字符\n  表格数: ${doc.tables?.length || 0}\n  图片数: ${doc.images?.length || 0}`
      ).join('\n\n');
    
      return {
        content: [
          {
            type: "text",
            text: `已存储的文档 (${docs.length} 个):\n\n${docList || "暂无存储的文档"}`
          }
        ]
      };
    }
  • server-basic.js:61-74 (registration)
    Registration of the 'list_stored_documents' tool in ListToolsRequestHandler, including name, description, and input schema.
    {
      name: "list_stored_documents",
      description: "列出所有已存储到内存的文档",
      inputSchema: {
        type: "object",
        properties: {
          documentType: {
            type: "string",
            description: "筛选特定类型的文档",
            enum: ["ui-component", "api-doc", "common-doc", "other"]
          }
        }
      }
    },
  • server.js:566-578 (registration)
    Registration of the 'list_stored_documents' tool in ListToolsRequestHandler for the enhanced server, including name, description, and input schema.
      name: "list_stored_documents",
      description: "列出所有已存储的文档",
      inputSchema: {
        type: "object",
        properties: {
          documentType: {
            type: "string",
            description: "筛选特定类型的文档",
            enum: ["ui-component", "api-doc", "common-doc", "other"]
          }
        }
      }
    },
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. It mentions listing documents but doesn't describe pagination behavior, rate limits, authentication requirements, or what 'stored' means in this context. The description is too minimal to adequately inform the agent about how this tool behaves.

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 that gets straight to the point with zero wasted words. It's perfectly concise and front-loaded with the core functionality.

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 list operation with no annotations and no output schema, the description is insufficient. It doesn't explain what information is returned about each document, whether results are paginated, or how 'documentType' filtering affects the output. The agent would need to guess about the tool's behavior and output format.

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 schema has 100% description coverage with a well-documented enum parameter. The description doesn't add any parameter information beyond what's in the schema, but since the schema already fully documents the single optional parameter, the baseline score of 3 is appropriate.

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 '列出所有已存储的文档' (List all stored documents) clearly states the verb (list) and resource (stored documents). It's specific about scope ('all'), but doesn't differentiate from sibling tools like 'search_documents' 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 'search_documents' (for filtered searches) or 'get_stored_document' (for retrieving a single document). It simply states what the tool does without context about appropriate use cases.

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