Skip to main content
Glama
little2512
by little2512

list_stored_documents

Retrieve stored Word documents by type to access and manage your document library efficiently.

Instructions

列出所有已存储的文档

Input Schema

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

Implementation Reference

  • The main handler for the 'list_stored_documents' tool. It retrieves all keys from the documentCache (NodeCache), fetches each document, filters by documentType if specified, formats a detailed list including memoryKey, filePath, type, timestamp, content length, tables, and images count, and returns it as formatted text content.
    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.js:565-578 (registration)
    Tool registration in the ListToolsRequestSchema handler, defining the tool's name, description, and input schema allowing optional 'documentType' filter.
    { name: "list_stored_documents", description: "列出所有已存储的文档", inputSchema: { type: "object", properties: { documentType: { type: "string", description: "筛选特定类型的文档", enum: ["ui-component", "api-doc", "common-doc", "other"] } } } },
  • Simpler handler implementation in the basic server version, listing documents from both uiComponentMemory and documentMemory Maps, handling ui-component specially, and formatting basic list info.
    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 || "暂无存储的文档"}` } ] }; }
  • server-basic.js:61-74 (registration)
    Tool registration in the basic server's ListToolsRequestSchema handler, with similar 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