Skip to main content
Glama
list-snapshots.tsβ€’1.24 kB
import { getSnapshotManager } from "./sdk-adapter.js"; /** * Add a snapshot to storage (store metadata) * * @param snapshot - The snapshot to add */ export function addSnapshot(snapshot: any): void { // Snapshots are automatically stored by the SnapshotManager // This function serves as a placeholder for any additional // metadata operations we might need to perform console.log("Snapshot added to storage:", snapshot.id); } /** * List all snapshots * * @returns Array of snapshots sorted by timestamp (newest first) */ export async function listSnapshots() { try { const manager = getSnapshotManager(); const snapshots = await manager.list(); // Format snapshots for MCP response const formatted = snapshots.map((snapshot) => ({ id: snapshot.id, timestamp: snapshot.timestamp, reason: snapshot.meta?.name || "Snapshot", fileCount: (snapshot.files || []).length, })); // Sort by timestamp (newest first) - already sorted by storage but ensure it const sorted = formatted.sort((a, b) => b.timestamp - a.timestamp); return { success: true, snapshots: sorted, }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : "Unknown error", }; } }

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/snapback-dev/mcp-server'

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