memory_export
Export memories from the DocuMCP server to JSON or CSV format for analysis or backup purposes.
Instructions
Export memories to JSON or CSV
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| format | No | Export format | json |
| filter | No | Filter memories to export |
Implementation Reference
- src/memory/index.ts:385-409 (schema)Input schema definition for the memory_export tool, specifying format (json/csv) and optional filters.{ name: "memory_export", description: "Export memories to JSON or CSV", inputSchema: { type: "object", properties: { format: { type: "string", enum: ["json", "csv"], description: "Export format", default: "json", }, filter: { type: "object", properties: { type: { type: "string" }, projectId: { type: "string" }, startDate: { type: "string", format: "date-time" }, endDate: { type: "string", format: "date-time" }, }, description: "Filter memories to export", }, }, }, },
- src/memory/index.ts:385-409 (registration)Tool registration within the memoryTools array exported for MCP integration.{ name: "memory_export", description: "Export memories to JSON or CSV", inputSchema: { type: "object", properties: { format: { type: "string", enum: ["json", "csv"], description: "Export format", default: "json", }, filter: { type: "object", properties: { type: { type: "string" }, projectId: { type: "string" }, startDate: { type: "string", format: "date-time" }, endDate: { type: "string", format: "date-time" }, }, description: "Filter memories to export", }, }, }, },
- src/memory/integration.ts:415-421 (handler)Wrapper function for memory export that initializes the manager and calls its export method, matching the tool's simple interface.export async function exportMemories( format: "json" | "csv" = "json", projectId?: string, ): Promise<string> { const manager = await initializeMemory(); return await manager.export(format, projectId); }
- src/memory/manager.ts:370-400 (handler)Core handler logic in MemoryManager.export that queries storage with optional projectId filter and generates JSON or CSV export string.async export( format: "json" | "csv" = "json", projectId?: string, ): Promise<string> { const filter = projectId ? { projectId } : {}; const allMemories = await this.storage.query(filter); if (format === "json") { return JSON.stringify(allMemories, null, 2); } else { // CSV export const headers = [ "id", "timestamp", "type", "projectId", "repository", "ssg", ]; const rows = allMemories.map((m: any) => [ m.id, m.timestamp, m.type, m.metadata?.projectId || "", m.metadata?.repository || "", m.metadata?.ssg || "", ]); return [headers, ...rows].map((r: any) => r.join(",")).join("\n"); } }