Skip to main content
Glama

list_backups

View available Minecraft world backups to restore previous game states. Filter results by world name to locate specific backup files for server recovery.

Instructions

List all available world backups, optionally filtered by world name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
world_nameNoFilter by world name (optional)

Implementation Reference

  • The implementation of `listBackups` in `BackupManager` which lists files in the backup directory and parses their information.
    /** List all backups */
    listBackups(worldName?: string): BackupInfo[] {
      this.ensureBackupDir();
    
      const files = fs.readdirSync(this.backupDir);
      const backups: BackupInfo[] = [];
    
      for (const file of files) {
        if (!file.endsWith(".tar.gz")) continue;
    
        const fullPath = path.join(this.backupDir, file);
        const stats = fs.statSync(fullPath);
        const baseName = file.replace(".tar.gz", "");
    
        // Parse world name from backup name (worldName_YYYY-MM-DD_HH-MM-SS)
        const underscoreIdx = baseName.indexOf("_");
        const parsedWorldName =
          underscoreIdx > 0 ? baseName.substring(0, underscoreIdx) : baseName;
    
        if (worldName && parsedWorldName !== worldName) continue;
    
        backups.push({
          name: baseName,
          worldName: parsedWorldName,
          timestamp: stats.mtime,
          sizeMB: Math.round((stats.size / (1024 * 1024)) * 100) / 100,
          path: fullPath,
        });
      }
    
      return backups.sort(
        (a, b) => b.timestamp.getTime() - a.timestamp.getTime()
      );
    }
  • Registration of the 'list_backups' tool using the McpServer and calling `backupManager.listBackups`.
    // --- List Backups ---
    server.tool(
      "list_backups",
      "List all available world backups, optionally filtered by world name.",
      {
        world_name: z
          .string()
          .optional()
          .describe("Filter by world name (optional)"),
      },
      async ({ world_name }) => {
        const backups = backupManager.listBackups(world_name);
        if (backups.length === 0) {
          return {
            content: [
              {
                type: "text",
                text: world_name
                  ? `No backups found for world "${world_name}".`
                  : "No backups found.",
              },
            ],
          };
        }
    
        const lines = backups.map(
          (b) =>
            `📦 ${b.name} | ${b.sizeMB} MB | ${b.timestamp.toISOString()}`
        );
        return {
          content: [
            {
              type: "text",
              text: `Found ${backups.length} backup(s):\n${lines.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/tamo2918/Minecraft-Server-MCP'

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