Skip to main content
Glama

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
NameRequiredDescriptionDefault
formatNoExport formatjson
filterNoFilter memories to export

Implementation Reference

  • 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", }, }, }, },
  • 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", }, }, }, },
  • 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); }
  • 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"); } }

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/tosin2013/documcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server