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"]
          }
        }
      }
    },

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