server_update_backup_config
Modify backup settings for Minecraft servers by adjusting retention limits, compression, pre/post commands, and directory exclusions.
Instructions
Update backup configuration for a Minecraft server
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| server_id | Yes | Server ID or UUID | |
| backup_name | No | Backup configuration name | |
| max_backups | No | Maximum number of backups to keep | |
| compress | No | Compress backups | |
| shutdown | No | Shut down server before backup | |
| before | No | Command to run before backup | |
| after | No | Command to run after backup | |
| excluded_dirs | No | Directories to exclude from backup |
Implementation Reference
- src/tools/server-backups.ts:36-58 (handler)The tool "server_update_backup_config" is defined and implemented within the `registerServerBackupTools` function in `src/tools/server-backups.ts`. The handler uses the `CraftyClient` to send a PATCH request to the server's backup configuration endpoint.
server.tool( "server_update_backup_config", "Update backup configuration for a Minecraft server", { server_id: z.string().describe("Server ID or UUID"), backup_name: z.string().min(3).optional().describe("Backup configuration name"), max_backups: z.number().optional().describe("Maximum number of backups to keep"), compress: z.boolean().optional().describe("Compress backups"), shutdown: z.boolean().optional().describe("Shut down server before backup"), before: z.string().optional().describe("Command to run before backup"), after: z.string().optional().describe("Command to run after backup"), excluded_dirs: z.array(z.string()).optional().describe("Directories to exclude from backup"), }, async ({ server_id, ...updates }) => { try { const data = await client.patch(`/servers/${server_id}/backups/config`, updates); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } catch (error) { const msg = error instanceof Error ? error.message : String(error); return { content: [{ type: "text", text: `Error: ${msg}` }], isError: true }; } } );