Skip to main content
Glama
little2512
by little2512

get_stored_document

Retrieve stored Word document content using a memory key to access previously cached files for analysis or processing.

Instructions

获取已存储的文档内容

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
memoryKeyYes要获取的文档内存键名

Implementation Reference

  • The main handler for the 'get_stored_document' tool. It retrieves the document data from the documentCache using the provided memoryKey, formats a comprehensive response including text content, tables, and image OCR results, and returns it as a text content block.
    case "get_stored_document": { const { memoryKey } = args; const doc = documentCache.get(memoryKey); if (!doc) { throw new Error(`未找到内存键为 "${memoryKey}" 的文档`); } let responseText = `文档内容 (内存键: ${memoryKey}):\n\n`; responseText += `文件路径: ${doc.filePath}\n`; responseText += `文档类型: ${doc.documentType}\n`; responseText += `处理时间: ${doc.timestamp}\n\n`; // 添加文本内容 if (doc.text) { responseText += `【文本内容】\n${doc.text}\n\n`; } // 添加表格内容 if (doc.tables && doc.tables.length > 0) { responseText += `【表格内容】(${doc.tables.length} 个)\n`; doc.tables.forEach((table, index) => { responseText += `\n表格${index + 1}:\n`; table.rows.forEach((row, rowIndex) => { responseText += `行${rowIndex + 1}: ${row.join(' | ')}\n`; }); }); } // 添加图片OCR内容 if (doc.images && doc.images.length > 0) { responseText += `【图片OCR内容】(${doc.images.length} 个)\n`; doc.images.forEach((image, index) => { responseText += `\n图片${index + 1} (${image.filename}):\n${image.ocrText}\n`; }); } return { content: [ { type: "text", text: responseText } ] }; }
  • server.js:579-592 (registration)
    Registration of the 'get_stored_document' tool in the ListToolsRequestHandler response, including its name, description, and input schema.
    { name: "get_stored_document", description: "获取已存储的文档内容", inputSchema: { type: "object", properties: { memoryKey: { type: "string", description: "要获取的文档内存键名" } }, required: ["memoryKey"] } },
  • Basic handler for the 'get_stored_document' tool in server-basic.js. Retrieves document from either uiComponentMemory or documentMemory Map using memoryKey and returns the content.
    case "get_stored_document": { const { memoryKey } = args; let doc = uiComponentMemory.get(memoryKey) || documentMemory.get(memoryKey); if (!doc) { throw new Error(`未找到内存键为 "${memoryKey}" 的文档`); } return { content: [ { type: "text", text: `文档内容 (内存键: ${memoryKey}):\n\n${doc.content}` } ] }; }
  • server-basic.js:75-88 (registration)
    Registration of the 'get_stored_document' tool in server-basic.js ListToolsRequestHandler.
    { name: "get_stored_document", description: "获取已存储的文档内容", inputSchema: { type: "object", properties: { memoryKey: { type: "string", description: "要获取的文档内存键名" } }, required: ["memoryKey"] } },

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