Skip to main content
Glama

index-restore

Restore notes from a JSON backup file to the MCP Index Notes server. Imports data and returns the count of successfully restored notes for efficient backup recovery.

Instructions

Restore notes from a JSON backup file. Returns imported count.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYes

Implementation Reference

  • The core handler logic for the 'index-restore' tool. Parses the input arguments using RestoreSchema, reads the backup file using readBackup function, imports the notes into the database store via importMany, and returns the count of imported notes.
    case 'index-restore': { const parsed = RestoreSchema.parse(args); const notes = readBackup(parsed.file); db.importMany(notes); return { content: [{ type: 'text', text: JSON.stringify({ imported: notes.length }) }] };
  • Zod schema defining the input for 'index-restore' tool, requiring a 'file' string path to the JSON backup.
    export const RestoreSchema = z.object({ file: z.string(), }); export type RestoreInput = z.infer<typeof RestoreSchema>;
  • src/mcp.ts:144-153 (registration)
    MCP tool registration object defining the name, description, and input schema for 'index-restore' in the tools array.
    name: 'index-restore', description: 'Restore notes from a JSON backup file. Returns imported count.', inputSchema: { type: 'object', properties: { file: { type: 'string' }, }, required: ['file'], }, },
  • Helper function readBackup that reads and parses the JSON backup file provided to index-restore, returning an array of notes.
    export function readBackup(file: string): Note[] { logger.info({ file }, 'Reading JSON backup'); const raw = fs.readFileSync(file, 'utf8'); const data = JSON.parse(raw) as { notes?: Note[] } | Note[]; if (Array.isArray(data)) return data; return data.notes ?? []; }

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/vjsr007/mcp-index-notes'

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